C# Класс Spring.Objects.Factory.Xml.AbstractObjectDefinitionParser

Abstract IObjectDefinitionParser implementation providing a number of convenience methods and a AbstractObjectDefinitionParser.ParseInternal template method that subclasses must override to provide the actual parsing logic.
Use this IObjectDefinitionParser implementation when you want to parse some arbitrarily complex XML into one or more IObjectDefinition ObjectDefinitions. If you just want to parse some XML into a single IObjectDefinition, you may wish to consider the simpler convenience extensions of this class, namely AbstractSingleObjectDefinitionParser and AbstractSimpleObjectDefinitionParser
Наследование: IObjectDefinitionParser
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
ID_ATTRIBUTE string

Открытые методы

Метод Описание
ParseElement ( XmlElement element, ParserContext parserContext ) : IObjectDefinition

Parse the specified XmlElement and register the resulting ObjectDefinitions with the ParserContext.Registry IObjectDefinitionRegistry embedded in the supplied ParserContext

This method is never invoked if the parser is namespace aware and was called to process the root node.

Защищенные методы

Метод Описание
GetAttributeValue ( XmlElement element, string attributeName ) : string

Returns the value of the element's attribute or null, if the attribute is not specified.

This is a helper for bypassing the behavior of XmlElement.GetAttribute(string) to return string.Empty if the attribute does not exist.

GetAttributeValue ( XmlElement element, string attributeName, string defaultValue ) : string

Returns the value of the element's attribute or defaultValue, if the attribute is not specified.

This is a helper for bypassing the behavior of XmlElement.GetAttribute(string) to return string.Empty if the attribute does not exist.

ParseInternal ( XmlElement element, ParserContext parserContext ) : AbstractObjectDefinition

Central template method to actually parse the supplied XmlElement into one or more IObjectDefinitions.

RegisterObjectDefinition ( Spring.Objects.Factory.Config.ObjectDefinitionHolder definition, IObjectDefinitionRegistry registry ) : void

Registers the supplied ObjectDefinitionHolder with the supplied IObjectDefinitionRegistry.

Subclasses can override this method to control whether or not the supplied ObjectDefinitionHolder is actually even registered, or to register even more objects.

The default implementation registers the supplied ObjectDefinitionHolder with the supplied ObjectDefinitionHolder only if the IsNested parameter is false, because one typically does not want inner objects to be registered as top level objects.

ResolveId ( XmlElement element, AbstractObjectDefinition definition, ParserContext parserContext ) : string

Resolves the ID for the supplied IObjectDefinition.

When using ShouldGenerateId generation, a name is generated automatically. Otherwise, the ID is extracted from the "id" attribute, potentially with a ShouldGenerateIdAsFallback fallback to a generated id.

Описание методов

GetAttributeValue() защищенный статический Метод

Returns the value of the element's attribute or null, if the attribute is not specified.
This is a helper for bypassing the behavior of XmlElement.GetAttribute(string) to return string.Empty if the attribute does not exist.
protected static GetAttributeValue ( XmlElement element, string attributeName ) : string
element System.Xml.XmlElement
attributeName string
Результат string

GetAttributeValue() защищенный статический Метод

Returns the value of the element's attribute or defaultValue, if the attribute is not specified.
This is a helper for bypassing the behavior of XmlElement.GetAttribute(string) to return string.Empty if the attribute does not exist.
protected static GetAttributeValue ( XmlElement element, string attributeName, string defaultValue ) : string
element System.Xml.XmlElement
attributeName string
defaultValue string
Результат string

ParseElement() публичный Метод

Parse the specified XmlElement and register the resulting ObjectDefinitions with the ParserContext.Registry IObjectDefinitionRegistry embedded in the supplied ParserContext

This method is never invoked if the parser is namespace aware and was called to process the root node.

public ParseElement ( XmlElement element, ParserContext parserContext ) : IObjectDefinition
element System.Xml.XmlElement The element to be parsed.
parserContext ParserContext The object encapsulating the current state of the parsing process. /// Provides access to a IObjectDefinitionRegistry
Результат IObjectDefinition

ParseInternal() защищенный абстрактный Метод

Central template method to actually parse the supplied XmlElement into one or more IObjectDefinitions.
protected abstract ParseInternal ( XmlElement element, ParserContext parserContext ) : AbstractObjectDefinition
element System.Xml.XmlElement The element that is to be parsed into one or more s
parserContext ParserContext The the object encapsulating the current state of the parsing process; /// provides access to a
Результат Spring.Objects.Factory.Support.AbstractObjectDefinition

RegisterObjectDefinition() защищенный Метод

Registers the supplied ObjectDefinitionHolder with the supplied IObjectDefinitionRegistry.
Subclasses can override this method to control whether or not the supplied ObjectDefinitionHolder is actually even registered, or to register even more objects.

The default implementation registers the supplied ObjectDefinitionHolder with the supplied ObjectDefinitionHolder only if the IsNested parameter is false, because one typically does not want inner objects to be registered as top level objects.

protected RegisterObjectDefinition ( Spring.Objects.Factory.Config.ObjectDefinitionHolder definition, IObjectDefinitionRegistry registry ) : void
definition Spring.Objects.Factory.Config.ObjectDefinitionHolder The object definition to be registered.
registry IObjectDefinitionRegistry The registry that the bean is to be registered with.
Результат void

ResolveId() защищенный Метод

Resolves the ID for the supplied IObjectDefinition.
When using ShouldGenerateId generation, a name is generated automatically. Otherwise, the ID is extracted from the "id" attribute, potentially with a ShouldGenerateIdAsFallback fallback to a generated id.
/// if no unique name could be generated for the given object definition ///
protected ResolveId ( XmlElement element, AbstractObjectDefinition definition, ParserContext parserContext ) : string
element System.Xml.XmlElement The element that the object definition has been built from.
definition Spring.Objects.Factory.Support.AbstractObjectDefinition The object definition to be registered.
parserContext ParserContext The the object encapsulating the current state of the parsing process; /// provides access to a
Результат string

Описание свойств

ID_ATTRIBUTE публичное статическое свойство

Constant for the ID attribute
public static string ID_ATTRIBUTE
Результат string