|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.xml.XmlReader
org.progeeks.util.xml.ObjectXmlReader
public class ObjectXmlReader
A general XML-based object reader. Handlers can be plugged in that support different object creation schemes. For example, a bean handler could create beans and set their properties, a MetaObject handler could do the same. Special handlers could even be registered that read specific attributes to construct an object. Internally, there are some directives that this reader supports that will be handled for the handlers. This includes things like the object referencing and such.
Nested Class Summary | |
---|---|
protected class |
ObjectXmlReader.ObjectTagReader
Handler that will dynamically deal with all of the different tags. |
Nested classes/interfaces inherited from class org.progeeks.util.xml.XmlReader |
---|
XmlReader.XmlHandler |
Field Summary | |
---|---|
static java.lang.String |
COLLECTION_VALUES_DIRECTIVE
|
static java.lang.String |
CONFIG_DIRECTIVE
|
static java.lang.String |
DIRECTIVE_PREFIX
|
static java.lang.String |
EXISTING_VALUE_DIRECTIVE
|
static java.lang.String |
FIELD_TYPE_DIRECTIVE
|
static java.lang.String |
OID_DIRECTIVE
|
static java.lang.String |
PRELOAD_DIRECTIVE
|
static java.lang.String |
REFERENCE_DIRECTIVE
|
Constructor Summary | |
---|---|
ObjectXmlReader()
Creates an ObjectXmlReader that will read an object from an XML file based on the handler plug-ins that are later registered with it. |
|
ObjectXmlReader(boolean addStandardHandlers)
Creates an ObjectXmlReader that will read an object from an XML file based on the handler plug-ins that are later registered with it. |
|
ObjectXmlReader(java.lang.String rootTag)
Creates an ObjectXmlReader that will read a list of objects from an XML file based on the handler plug-ins that are later registered with it. |
|
ObjectXmlReader(java.lang.String rootTag,
boolean addStandardHandlers)
Creates an ObjectXmlReader that will read a list of objects from an XML file based on the handler plug-ins that are later registered with it. |
Method Summary | |
---|---|
void |
addObjectHandler(ObjectHandler handler)
Adds an object handler to the list of handlers. |
void |
addObjectTagAlias(java.lang.String objectTag,
java.lang.String alias)
Adds an alias that will be used to replace any matching object-level tag with the specified alias. |
void |
addStandardObjectHandlers()
Automatically registers a set of commonly used object handlers. |
protected void |
configureHandlers(org.xml.sax.Attributes atts)
Sends configuration properties to all handlers. |
protected ObjectHandler |
getHandler(java.lang.String tag)
Locates the appropriate handler for the given object tag. |
java.util.List |
getObjectHandlers()
Returns the list of handler plug-ins that this reader will use to resolve its object tags. |
java.lang.Object |
getReferenceObject(java.lang.String id)
Returns an object for the specified ID if one exists. |
boolean |
ignoreAttribute(java.lang.String name)
Returns true if the specified attribute should be ignored for regular object-level property processing. |
java.lang.Object |
readObject(org.w3c.dom.Document in)
Reads the XML from a DOM tree as an object and returns it. |
java.lang.Object |
readObject(org.w3c.dom.Document in,
javax.xml.transform.Transformer transformer)
Reads the XML from a DOM tree as object, applying the given transformation. |
java.lang.Object |
readObject(java.io.Reader in)
Reads the XML as a meta-object and returns it. |
protected void |
reset()
Resets the internal data structures before reading another object. |
void |
setObjectHandlers(java.util.List handlers)
Sets the list of handler plug-ins that this reader will use to resolve its object tags. |
Methods inherited from class org.progeeks.util.xml.XmlReader |
---|
addTagText, createXmlException, createXmlException, endTag, getAttributesAsMap, getCurrentObject, getDocumentLocator, getIgnoreTagCase, getLocation, getPreviousObject, getRootObject, getStackSize, getTagReader, readXml, readXml, readXml, registerHandler, replaceCurrentObject, resolveEntity, setDefaultHandler, setIgnoreTagCase, startTag |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DIRECTIVE_PREFIX
public static final java.lang.String OID_DIRECTIVE
public static final java.lang.String REFERENCE_DIRECTIVE
public static final java.lang.String FIELD_TYPE_DIRECTIVE
public static final java.lang.String COLLECTION_VALUES_DIRECTIVE
public static final java.lang.String CONFIG_DIRECTIVE
public static final java.lang.String PRELOAD_DIRECTIVE
public static final java.lang.String EXISTING_VALUE_DIRECTIVE
Constructor Detail |
---|
public ObjectXmlReader()
public ObjectXmlReader(boolean addStandardHandlers)
public ObjectXmlReader(java.lang.String rootTag)
public ObjectXmlReader(java.lang.String rootTag, boolean addStandardHandlers)
Method Detail |
---|
public void addStandardObjectHandlers()
public void setObjectHandlers(java.util.List handlers)
public void addObjectHandler(ObjectHandler handler)
public java.util.List getObjectHandlers()
public void addObjectTagAlias(java.lang.String objectTag, java.lang.String alias)
public java.lang.Object readObject(java.io.Reader in) throws java.io.IOException
readObject
in class XmlReader
java.io.IOException
public java.lang.Object readObject(org.w3c.dom.Document in) throws XmlException
XmlException
public java.lang.Object readObject(org.w3c.dom.Document in, javax.xml.transform.Transformer transformer) throws XmlException
XmlException
public boolean ignoreAttribute(java.lang.String name)
public java.lang.Object getReferenceObject(java.lang.String id)
protected void reset()
reset
in class XmlReader
protected ObjectHandler getHandler(java.lang.String tag)
protected void configureHandlers(org.xml.sax.Attributes atts)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |