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.
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList |
attributeDefinition
The attribute definition.
|
private java.lang.String |
attributeName
The attribute name.
|
private java.lang.String |
baseClass
The base class.
|
private java.util.ArrayList |
constructorDefinition
The constructor definition.
|
private java.util.ArrayList |
lookupDefinitions
The lookup definitions.
|
private java.util.HashMap |
manualMappings
Manual mappings.
|
private java.util.ArrayList |
multiplexEntries
The multiplex entries.
|
private java.util.HashMap |
multiplexMappings
Multiplex mappings.
|
private java.util.HashMap |
objectMappings
Maps classes to GenericObjectFactory instances.
|
private java.util.ArrayList |
orderedNames
The ordered names.
|
private java.util.ArrayList |
propertyDefinition
The property definition.
|
private java.lang.String |
registerName
The register name.
|
private java.lang.Class |
target
The target class.
|
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.
|
private AttributeHandler |
loadAttributeHandler(java.lang.String attribute)
Loads an instantiates the attribute handler specified by the given
class name.
|
private void |
performSuperClassUpdate(GenericObjectFactory gef) |
private void |
rebuildSuperClasses() |
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
private java.util.HashMap objectMappings
private java.util.HashMap manualMappings
private java.util.HashMap multiplexMappings
private java.lang.Class target
private java.lang.String registerName
private java.util.ArrayList propertyDefinition
private java.util.ArrayList attributeDefinition
private java.util.ArrayList constructorDefinition
private java.util.ArrayList lookupDefinitions
private java.util.ArrayList orderedNames
private java.lang.String baseClass
private java.lang.String attributeName
private java.util.ArrayList multiplexEntries
public ObjectFactoryLoader(java.net.URL resourceName) throws ObjectDescriptionException
resourceName
- the URL of the initial specification file.ObjectDescriptionException
- if the file could not be parsed.private void rebuildSuperClasses() throws ObjectDescriptionException
ObjectDescriptionException
private void performSuperClassUpdate(GenericObjectFactory gef)
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.private AttributeHandler loadAttributeHandler(java.lang.String attribute) throws ObjectDescriptionException
attribute
- the attribute handlers classname.ObjectDescriptionException
- if the handler could not be loaded.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