|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.openharbor.beck.unmarshal.DefaultUnmarshaller
com.openharbor.beck.unmarshal.JavaBeanUnmarshaller
com.openharbor.beck.unmarshal.ContractionUnmarshaller
Maps two levels of the XML tree to one level of the object tree. So, there is no object that corresponds to this.getSource(), but each of the XML elements or attributes contained in this getSource() maps to an object. Those objects' types and names are mapped from XML names formed by concatenating the name of this.getSource and the name of each child source. For example,
<money>
<value>29.99</value>
<currency>USD</currency>
</money>
is handled like:
<moneyValue>29.99</moneyValue> <moneyCurrency>USD</moneyCurrency>A ContractionUnmarshaller acts as its own Setter (by default), with a setValue method that does nothing.
ContractionUnmarshallers can be cascaded, to map three or more levels of XML containment to a single level of Java object references.
| Field Summary |
| Fields inherited from class com.openharbor.beck.unmarshal.JavaBeanUnmarshaller |
STRING_PARAMETER |
| Fields inherited from class com.openharbor.beck.unmarshal.DefaultUnmarshaller |
data, documentState, log |
| Fields inherited from interface com.openharbor.beck.configure.Configurable |
ATTRIBUTE, CLASS_IS_ARRAY, DIRECTION, ELEMENT, JAVA_TO_XML, NAMESPACE, NONE, PARENT_CLASS, PARENT_ELEMENT, PREDICATE, PREFIX, SCHEMA_LOCATION, TEXT, XML_TO_JAVA |
| Constructor Summary | |
ContractionUnmarshaller()
|
|
| Method Summary | |
void |
addChild(Unmarshaller child)
Create a reference from this object to the given child object. |
protected void |
afterEndObject()
Don't call this.addToParent (as the inherited method would). |
protected XMLThing |
contract(XMLThing source)
Insert this.getSource().getName() in front of the given thing's name. |
java.lang.Class |
getChildClass(XMLThing childSource)
Choose the class of the object to be mapped from a contained XML attribute or element. |
java.util.Map |
getConfiguration()
|
java.lang.Object |
getObject()
|
java.lang.Object |
getValue(Unmarshaller self,
java.lang.Object[] getterParameters)
Traverse an existing relationship from parent to child. |
java.lang.Class |
getValueClass(JavaBeanUnmarshaller parent)
Find the expected class of a child object; for example, the declared class of a field or JavaBean property. |
java.lang.Object |
removeValue(Unmarshaller self,
java.lang.Object[] getterParameters)
|
java.lang.Object |
replaceValue(Unmarshaller self,
java.lang.Object[] getterParameters)
|
void |
setConfiguration(java.util.Map configuration)
|
protected void |
setParentAndSource(Unmarshaller parent,
XMLThing source)
Maintain an engagement on the parent Unmarshaller. |
void |
setValue(Unmarshaller self,
java.lang.Object[] getterParameters)
Create a relationship from parent to child. |
| Methods inherited from class com.openharbor.beck.unmarshal.JavaBeanUnmarshaller |
getSetter, setValue, startElement |
| Methods inherited from class com.openharbor.beck.unmarshal.DefaultUnmarshaller |
addToParent, addValue, disengage, disengaged, endElement, endObject, engage, getMap, getMapFromXML, getObjectClass, getParent, getSource, getSourceXPath, getXMLContext, getXName, getXPath, isEngaged, newObject, processAttributes, referToThis, reset, rethrow, setMapFromXML, setObject, setObjectClass, setXMLContext, startObject, toString, trim |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ContractionUnmarshaller()
| Method Detail |
public java.util.Map getConfiguration()
getConfiguration in interface Configurablepublic void setConfiguration(java.util.Map configuration)
setConfiguration in interface Configurable
protected void setParentAndSource(Unmarshaller parent,
XMLThing source)
When ContractionUnmarshallers are cascaded, they build up a chain of engagements, with each engaging its parent.
setParentAndSource in class DefaultUnmarshallerpublic java.lang.Object getObject()
getObject in interface UnmarshallergetObject in class DefaultUnmarshaller
public java.lang.Class getChildClass(XMLThing childSource)
throws java.lang.Exception
Unmarshaller
getChildClass in interface UnmarshallergetChildClass in class JavaBeanUnmarshallerjava.lang.Exception
public void addChild(Unmarshaller child)
throws java.lang.Exception
Unmarshaller
addChild in interface UnmarshalleraddChild in class JavaBeanUnmarshallerjava.lang.Exceptionprotected void afterEndObject()
afterEndObject in class DefaultUnmarshallerprotected XMLThing contract(XMLThing source)
public java.lang.Class getValueClass(JavaBeanUnmarshaller parent)
Setter
getValueClass in interface Setterparent - describes the parent object, or null
if the parent is not yet known.
public void setValue(Unmarshaller self,
java.lang.Object[] getterParameters)
Setter
setValue in interface Setterself - describes the child object. child.getParent() describes the parent.getterParameters - additional parameters to the setter method, such as LocaleTag.
public java.lang.Object getValue(Unmarshaller self,
java.lang.Object[] getterParameters)
SetterTraverse an existing relationship from parent to child. Call child.setObject() and child.setObjectClass() to record the child's identity and type, and return a reference to the child.
This method is used to resolve XPaths. Given an object and an XPath, we create an Unmarshaller for every level of the XPath, use the mapper to retrieve the corresponding setters, then traverse the object model using this method.
getValue in interface Setterself - Child unmarshaller, which represents the property we're interested in. The parent
(or the object whose property is to be read) can be accessed by child.getParent().getterParameters - the parameters the getter takes. Typically, getters take no parameters,
and null can be passed in. With mutli-lingual properties however,
LocaleTag must be passed in to identify the language of interest,
public java.lang.Object removeValue(Unmarshaller self,
java.lang.Object[] getterParameters)
removeValue in interface Setter
public java.lang.Object replaceValue(Unmarshaller self,
java.lang.Object[] getterParameters)
replaceValue in interface Setter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||