Class AbstractModelReader
java.lang.Object
org.jfree.xml.util.AbstractModelReader
- Direct Known Subclasses:
DefaultModelReader, ObjectFactoryLoader
Loads the class model from an previously written xml file set.
This class provides abstract methods which get called during the parsing
(similiar to the SAX parsing, but slightly easier to code).
This will need a rewrite in the future, when the structure is finished.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidEnd handling an include.protected abstract voidFinializes the multiplexer mapping.protected abstract voidFinializes the object definition.protected voidEnd the root document.protected String[]Returns the close comment.protected CommentHandlerReturns the comment handler.protected String[]Returns the open comment.protected abstract voidhandleAttributeDefinition(String name, String attribName, String handlerClass) Handles an attribute definition.protected abstract voidhandleConstructorDefinition(String propertyName, String parameterClass) Handles a constructor definition.protected abstract voidhandleElementDefinition(String name, String element) Handles an element definition.protected voidhandleIgnoredProperty(String name) Callback method for ignored properties.protected abstract voidhandleLookupDefinition(String name, String lookupKey) Handles an lookup definition.protected abstract booleanhandleManualMapping(String className, String readHandler, String writeHandler) Handles a manual mapping definition.protected abstract voidhandleMultiplexMapping(String typeName, String className) Defines an entry for the multiplex mapping.protected ClassLoads the given class, and ignores all exceptions which may occur during the loading.protected voidParses an XML document at the given URL.protected voidparseXmlDocument(URL resource, boolean isInclude) Parses the given specification and loads all includes specified in the files.protected voidsetCloseComment(String[] closeComment) Sets the close comment.protected voidsetOpenComment(String[] openComment) Sets the open comment.protected voidstartIncludeHandling(URL resource) Start handling an include.protected abstract voidstartMultiplexMapping(String className, String typeAttr) Starts a multiplex mapping.protected abstract booleanstartObjectDefinition(String className, String register, boolean ignored) Starts a object definition.protected voidStart the root document.
-
Constructor Details
-
AbstractModelReader
public AbstractModelReader()Default Constructor.
-
-
Method Details
-
getCommentHandler
Returns the comment handler.- Returns:
- The comment handler.
-
getCloseComment
-
getOpenComment
-
setCloseComment
Sets the close comment.- Parameters:
closeComment- the close comment.
-
setOpenComment
Sets the open comment.- Parameters:
openComment- the open comment.
-
parseXml
Parses an XML document at the given URL.- Parameters:
resource- the document URL.- Throws:
ObjectDescriptionException- ??
-
parseXmlDocument
Parses the given specification and loads all includes specified in the files. This implementation does not check for loops in the include files.- Parameters:
resource- the url of the xml specification.isInclude- an include?- Throws:
ObjectDescriptionException- if an error occured which prevented the loading of the specifications.
-
startRootDocument
Start the root document. -
endRootDocument
End the root document. -
startIncludeHandling
Start handling an include.- Parameters:
resource- the URL.
-
endIncludeHandling
End handling an include. -
handleIgnoredProperty
Callback method for ignored properties. Such properties get marked so that the information regarding these properties won't get lost.- Parameters:
name- the name of the ignored property.
-
handleManualMapping
protected abstract boolean handleManualMapping(String className, String readHandler, String writeHandler) throws ObjectDescriptionException Handles a manual mapping definition. The manual mapping maps specific read and write handlers to a given base class. Manual mappings always override any other definition.- Parameters:
className- the base class namereadHandler- the class name of the read handlerwriteHandler- the class name of the write handler- Returns:
- true, if the mapping was accepted, false otherwise.
- Throws:
ObjectDescriptionException- if an unexpected error occured.
-
startObjectDefinition
protected abstract boolean startObjectDefinition(String className, String register, boolean ignored) throws ObjectDescriptionException Starts a object definition. The object definition collects all properties of an bean-class and defines, which constructor should be used when creating the class.- Parameters:
className- the class name of the defined objectregister- the (optional) register name, to lookup and reference the object later.ignored- ??.- Returns:
- true, if the definition was accepted, false otherwise.
- Throws:
ObjectDescriptionException- if an unexpected error occured.
-
handleAttributeDefinition
protected abstract void handleAttributeDefinition(String name, String attribName, String handlerClass) throws ObjectDescriptionException Handles an attribute definition. This method gets called after the object definition was started. The method will be called for every defined attribute property.- Parameters:
name- the name of the propertyattribName- the xml-attribute name to use later.handlerClass- the attribute handler class.- Throws:
ObjectDescriptionException- if an error occured.
-
handleElementDefinition
protected abstract void handleElementDefinition(String name, String element) throws ObjectDescriptionException Handles an element definition. This method gets called after the object definition was started. The method will be called for every defined element property. Element properties are used to describe complex objects.- Parameters:
name- the name of the propertyelement- the xml-tag name for the child element.- Throws:
ObjectDescriptionException- if an error occurs.
-
handleLookupDefinition
protected abstract void handleLookupDefinition(String name, String lookupKey) throws ObjectDescriptionException Handles an lookup definition. This method gets called after the object definition was started. The method will be called for every defined lookup property. Lookup properties reference previously created object using the object's registry name.- Parameters:
name- the property name of the base objectlookupKey- the register key of the referenced object- Throws:
ObjectDescriptionException- if an error occured.
-
endObjectDefinition
Finializes the object definition.- Throws:
ObjectDescriptionException- if an error occures.
-
startMultiplexMapping
Starts a multiplex mapping. Multiplex mappings are used to define polymorphic argument handlers. The mapper will collect all derived classes of the given base class and will select the corresponding mapping based on the given type attribute.- Parameters:
className- the base class nametypeAttr- the xml-attribute name containing the mapping key
-
handleMultiplexMapping
protected abstract void handleMultiplexMapping(String typeName, String className) throws ObjectDescriptionException Defines an entry for the multiplex mapping. The new entry will be activated when the base mappers type attribute contains thistypenameand will resolve to the handler for the given classname.- Parameters:
typeName- the type value for this mapping.className- the class name to which this mapping resolves.- Throws:
ObjectDescriptionException- if an error occurs.
-
endMultiplexMapping
Finializes the multiplexer mapping.- Throws:
ObjectDescriptionException- if an error occurs.
-
handleConstructorDefinition
protected abstract void handleConstructorDefinition(String propertyName, String parameterClass) throws ObjectDescriptionException Handles a constructor definition. Only one constructor can be defined for a certain object type. The constructor will be filled using the given properties.- Parameters:
propertyName- the property name of the referenced local propertyparameterClass- the parameter class for the parameter.- Throws:
ObjectDescriptionException- if an error occured.
-
loadClass
-