public class ObjectFactoryLoader extends AbstractModelReader implements ObjectFactory
This class provides the model management for the reader and writer. The instantiation of the handlers is done elsewhere.
Constructor and Description |
---|
ObjectFactoryLoader(java.net.URL resourceName)
Creates a new object factory loader for the given base file.
|
Modifier and Type | Method and Description |
---|---|
protected void |
endMultiplexMapping()
Finializes the multiplexer mapping.
|
protected void |
endObjectDefinition()
Finializes the object definition.
|
GenericObjectFactory |
getFactoryForClass(java.lang.Class c)
Returns a factory instance for the given class.
|
ManualMappingDefinition |
getManualMappingDefinition(java.lang.Class c)
Returns the manual mapping definition for the given class, or null, if
not manual definition exists.
|
MultiplexMappingDefinition |
getMultiplexDefinition(java.lang.Class c)
Returns the multiplex definition for the given class, or null, if no
such definition exists.
|
protected void |
handleAttributeDefinition(java.lang.String name,
java.lang.String attribName,
java.lang.String handlerClass)
Handles an attribute definition.
|
protected void |
handleConstructorDefinition(java.lang.String propertyName,
java.lang.String parameterClass)
Handles a constructor definition.
|
protected void |
handleElementDefinition(java.lang.String name,
java.lang.String element)
Handles an element definition.
|
protected void |
handleLookupDefinition(java.lang.String name,
java.lang.String lookupKey)
Handles an lookup definition.
|
protected boolean |
handleManualMapping(java.lang.String className,
java.lang.String readHandler,
java.lang.String writeHandler)
Handles a manual mapping definition.
|
protected void |
handleMultiplexMapping(java.lang.String typeName,
java.lang.String className)
Defines an entry for the multiplex mapping.
|
boolean |
isGenericHandler(java.lang.Class c)
Checks, whether the factory has a description for the given class.
|
protected void |
startMultiplexMapping(java.lang.String className,
java.lang.String typeAttr)
Starts a multiplex mapping.
|
protected boolean |
startObjectDefinition(java.lang.String className,
java.lang.String register,
boolean ignore)
Starts a object definition.
|
endIncludeHandling, endRootDocument, getCloseComment, getCommentHandler, getOpenComment, handleIgnoredProperty, loadClass, parseXml, parseXmlDocument, setCloseComment, setOpenComment, startIncludeHandling, startRootDocument
public ObjectFactoryLoader(java.net.URL resourceName) throws ObjectDescriptionException
resourceName
- the URL of the initial specification file.ObjectDescriptionException
- if the file could not be parsed.protected boolean startObjectDefinition(java.lang.String className, java.lang.String register, boolean ignore) throws ObjectDescriptionException
startObjectDefinition
in class AbstractModelReader
className
- the class name of the defined objectregister
- the (optional) register name, to lookup and reference the object later.ignore
- ignore?ObjectDescriptionException
- if an unexpected error occured.protected void handleAttributeDefinition(java.lang.String name, java.lang.String attribName, java.lang.String handlerClass) throws ObjectDescriptionException
handleAttributeDefinition
in class AbstractModelReader
name
- the name of the propertyattribName
- the xml-attribute name to use later.handlerClass
- the attribute handler class.ObjectDescriptionException
- if an error occured.protected void handleElementDefinition(java.lang.String name, java.lang.String element) throws ObjectDescriptionException
handleElementDefinition
in class AbstractModelReader
name
- the name of the propertyelement
- the xml-tag name for the child element.ObjectDescriptionException
- if an error occurs.protected void handleLookupDefinition(java.lang.String name, java.lang.String lookupKey) throws ObjectDescriptionException
handleLookupDefinition
in class AbstractModelReader
name
- the property name of the base objectlookupKey
- the register key of the referenced objectObjectDescriptionException
- if an error occured.protected void endObjectDefinition() throws ObjectDescriptionException
endObjectDefinition
in class AbstractModelReader
ObjectDescriptionException
- if an error occures.protected void handleConstructorDefinition(java.lang.String propertyName, java.lang.String parameterClass)
handleConstructorDefinition
in class AbstractModelReader
propertyName
- the property name of the referenced local propertyparameterClass
- the parameter class for the parameter.protected boolean handleManualMapping(java.lang.String className, java.lang.String readHandler, java.lang.String writeHandler) throws ObjectDescriptionException
handleManualMapping
in class AbstractModelReader
className
- the base class namereadHandler
- the class name of the read handlerwriteHandler
- the class name of the write handlerObjectDescriptionException
- if an unexpected error occured.protected void startMultiplexMapping(java.lang.String className, java.lang.String typeAttr)
startMultiplexMapping
in class AbstractModelReader
className
- the base class nametypeAttr
- the xml-attribute name containing the mapping keyprotected void handleMultiplexMapping(java.lang.String typeName, java.lang.String className) throws ObjectDescriptionException
typename
and
will resolve to the handler for the given classname.handleMultiplexMapping
in class AbstractModelReader
typeName
- the type value for this mapping.className
- the class name to which this mapping resolves.ObjectDescriptionException
- if an error occurs.protected void endMultiplexMapping() throws ObjectDescriptionException
endMultiplexMapping
in class AbstractModelReader
ObjectDescriptionException
- if an error occurs.public boolean isGenericHandler(java.lang.Class c)
isGenericHandler
in interface ObjectFactory
c
- the class to be handled by the factory.public GenericObjectFactory getFactoryForClass(java.lang.Class c)
getFactoryForClass
in interface ObjectFactory
c
- the classpublic ManualMappingDefinition getManualMappingDefinition(java.lang.Class c)
getManualMappingDefinition
in interface ObjectFactory
c
- the class for which to check the existence of the definitionpublic MultiplexMappingDefinition getMultiplexDefinition(java.lang.Class c)
getMultiplexDefinition
in interface ObjectFactory
c
- the class for which to check the existence of the multiplexer