|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Object | +--org.sapia.util.xml.confix.AbstractXMLProcessor
This class defines the behavior for generating an object graph from an XML document.
| Constructor Summary | |
|---|---|
AbstractXMLProcessor(ObjectFactoryIF anObjectFactory)
Creates a new AbstractXMLProcessor instance with the argument passed in. |
|
| Method Summary | |
|---|---|
protected static void |
assignToParent(Object aParent,
Object aChild,
String anElementName)
Assigns the given child object to the parent one. |
protected static boolean |
containsMethod(String prefix,
Object target,
String elemName)
|
protected static String |
convertChars(char[] toConvert,
String aSource)
|
protected static String |
formatElementName(String elemName)
Formats an element name according to the rules defined by the above method. |
protected ObjectFactoryIF |
getObjectFactory()
Returns the ObjectFactoryIF method held within this
instance. |
protected static Object |
invokeMethod(String aMethodName,
Object aTarget,
Object aValue)
Invokes the method whose name is given on the provided target instance. |
protected static void |
invokeSetter(String anElementName,
Object aTarget,
String anAttributeName,
String aValue)
Invokes the setXXXX/addXXXX method corresponding to the given attribute name. |
protected static String |
toMethodName(String attrName)
Converts the given attribute name to a method name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.sapia.util.xml.confix.ConfixProcessorIF |
|---|
process |
| Constructor Detail |
public AbstractXMLProcessor(ObjectFactoryIF anObjectFactory)
anObjectFactory - The object factory of this processor.| Method Detail |
protected static void assignToParent(Object aParent,
Object aChild,
String anElementName)
throws ConfigurationException
child object to the parent one.
This method searches for the method name based on the elementName
parameter, which is the name of an XML element. The method name must match
either the setXXX or addXXX pattern; for example, for an XML element named
'elephant', the class of the parent object should contain either
the setElephant or addElephant method.
aParent - the object to child will be set or addedaChild - the object to add to parentanElementName - the name of the XML element to which a addXXX or
setXXX method should correspond in the parent object.
ConfigurationException
protected static void invokeSetter(String anElementName,
Object aTarget,
String anAttributeName,
String aValue)
throws ConfigurationException
anElementName - the XML element name corresponding to the passed in target.aTarget - the instance on which to invoke the method.anAttributeName - the name of the attribute whose corresponding method
is called.aValue - the value to assign to the setter/adder method - the value is
coerced to the type expected by the method.
ConfigurationException
protected static Object invokeMethod(String aMethodName,
Object aTarget,
Object aValue)
throws ConfigurationException,
NoSuchMethodException
aMethodName - the name of the method to invoke.aTarget - the instance on which to invoke the method.aValue - the value to pass to the method that will be called.
ConfigurationException
NoSuchMethodExceptionprotected static String toMethodName(String attrName)
protected static boolean containsMethod(String prefix,
Object target,
String elemName)
protected static String formatElementName(String elemName)
protected static String convertChars(char[] toConvert,
String aSource)
protected ObjectFactoryIF getObjectFactory()
ObjectFactoryIF method held within this
instance.
|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||