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(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(Class c)
Returns a factory instance for the given class.
|
ManualMappingDefinition |
getManualMappingDefinition(Class c)
Returns the manual mapping definition for the given class, or null, if
not manual definition exists.
|
MultiplexMappingDefinition |
getMultiplexDefinition(Class c)
Returns the multiplex definition for the given class, or null, if no
such definition exists.
|
protected void |
handleAttributeDefinition(String name,
String attribName,
String handlerClass)
Handles an attribute definition.
|
protected void |
handleConstructorDefinition(String propertyName,
String parameterClass)
Handles a constructor definition.
|
protected void |
handleElementDefinition(String name,
String element)
Handles an element definition.
|
protected void |
handleLookupDefinition(String name,
String lookupKey)
Handles an lookup definition.
|
protected boolean |
handleManualMapping(String className,
String readHandler,
String writeHandler)
Handles a manual mapping definition.
|
protected void |
handleMultiplexMapping(String typeName,
String className)
Defines an entry for the multiplex mapping.
|
boolean |
isGenericHandler(Class c)
Checks, whether the factory has a description for the given class.
|
protected void |
startMultiplexMapping(String className,
String typeAttr)
Starts a multiplex mapping.
|
protected boolean |
startObjectDefinition(String className,
String register,
boolean ignore)
Starts a object definition.
|
endIncludeHandling, endRootDocument, getCloseComment, getCommentHandler, getOpenComment, handleIgnoredProperty, loadClass, parseXml, parseXmlDocument, setCloseComment, setOpenComment, startIncludeHandling, startRootDocument
public ObjectFactoryLoader(URL resourceName) throws ObjectDescriptionException
resourceName
- the URL of the initial specification file.ObjectDescriptionException
- if the file could not be parsed.protected boolean startObjectDefinition(String className, 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(String name, String attribName, 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(String name, 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(String name, 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(String propertyName, String parameterClass)
handleConstructorDefinition
in class AbstractModelReader
propertyName
- the property name of the referenced local propertyparameterClass
- the parameter class for the parameter.protected boolean handleManualMapping(String className, String readHandler, 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(String className, String typeAttr)
startMultiplexMapping
in class AbstractModelReader
className
- the base class nametypeAttr
- the xml-attribute name containing the mapping keyprotected void handleMultiplexMapping(String typeName, 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(Class c)
isGenericHandler
in interface ObjectFactory
c
- the class to be handled by the factory.public GenericObjectFactory getFactoryForClass(Class c)
getFactoryForClass
in interface ObjectFactory
c
- the classpublic ManualMappingDefinition getManualMappingDefinition(Class c)
getManualMappingDefinition
in interface ObjectFactory
c
- the class for which to check the existence of the definitionpublic MultiplexMappingDefinition getMultiplexDefinition(Class c)
getMultiplexDefinition
in interface ObjectFactory
c
- the class for which to check the existence of the multiplexerCopyright © 2001–2018 JFree.org. All rights reserved.