com.openharbor.beck.unmarshal
Class ArrayUnmarshaller

java.lang.Object
  extended bycom.openharbor.beck.unmarshal.DefaultUnmarshaller
      extended bycom.openharbor.beck.unmarshal.GroupUnmarshaller
          extended bycom.openharbor.beck.unmarshal.ArrayUnmarshaller
All Implemented Interfaces:
MapFromXML.Aware, Setter, Unmarshaller

public class ArrayUnmarshaller
extends GroupUnmarshaller
implements Setter

Maps to a collection, with members mapped from contained elements.


Field Summary
protected  java.lang.Class elementClass
           
protected  java.util.List list
           
 
Fields inherited from class com.openharbor.beck.unmarshal.DefaultUnmarshaller
data, documentState, log
 
Constructor Summary
ArrayUnmarshaller()
           
 
Method Summary
 void addChild(Unmarshaller child)
          Create a reference from this object to the given child object.
protected  java.util.Collection getCollection()
           
 java.lang.Object getValue(Unmarshaller child, 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.
protected  java.lang.Object newObject()
           
 java.lang.Object removeValue(Unmarshaller child, java.lang.Object[] getterParameters)
           
 java.lang.Object replaceValue(Unmarshaller child, java.lang.Object[] getterParameters)
           
protected  void setValue(java.lang.StringBuffer data)
          Convert the text and store the resulting data into the object.
 void setValue(Unmarshaller child, java.lang.Object[] getterParameters)
          Create a relationship from parent to child.
 
Methods inherited from class com.openharbor.beck.unmarshal.GroupUnmarshaller
locateChild, removeChildAt, removeLastChild, swapLastChildWith
 
Methods inherited from class com.openharbor.beck.unmarshal.DefaultUnmarshaller
addToParent, addValue, afterEndObject, disengage, disengaged, endElement, endObject, engage, getChildClass, getMap, getMapFromXML, getObject, getObjectClass, getParent, getSource, getSourceXPath, getXMLContext, getXName, getXPath, isEngaged, processAttributes, referToThis, reset, rethrow, setMapFromXML, setObject, setObjectClass, setParentAndSource, setXMLContext, startElement, startObject, toString, trim
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected java.util.List list

elementClass

protected java.lang.Class elementClass
Constructor Detail

ArrayUnmarshaller

public ArrayUnmarshaller()
Method Detail

newObject

protected java.lang.Object newObject()
Overrides:
newObject in class DefaultUnmarshaller

addChild

public void addChild(Unmarshaller child)
              throws java.lang.Exception
Description copied from interface: Unmarshaller
Create a reference from this object to the given child object. For example, set a reference-valued JavaBean property, or add a member to a Collection.

Specified by:
addChild in interface Unmarshaller
Overrides:
addChild in class DefaultUnmarshaller
Throws:
java.lang.Exception

getCollection

protected java.util.Collection getCollection()
Specified by:
getCollection in class GroupUnmarshaller

setValue

public void setValue(Unmarshaller child,
                     java.lang.Object[] getterParameters)
              throws java.lang.Exception
Description copied from interface: Setter
Create a relationship from parent to child. Ordinarily, set a member of the parent to refer to the child.

Specified by:
setValue in interface Setter
Parameters:
child - describes the child object. child.getParent() describes the parent.
getterParameters - additional parameters to the setter method, such as LocaleTag.
Throws:
java.lang.Exception - something went wrong

getValue

public java.lang.Object getValue(Unmarshaller child,
                                 java.lang.Object[] getterParameters)
                          throws java.lang.Exception
Description copied from interface: Setter

Traverse 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.

Specified by:
getValue in interface Setter
Parameters:
child - 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,
Returns:
a reference to the child object, or null if there is no existing child.
Throws:
java.lang.Exception - something went wrong

removeValue

public java.lang.Object removeValue(Unmarshaller child,
                                    java.lang.Object[] getterParameters)
                             throws java.lang.Exception
Specified by:
removeValue in interface Setter
Throws:
java.lang.Exception

replaceValue

public java.lang.Object replaceValue(Unmarshaller child,
                                     java.lang.Object[] getterParameters)
                              throws java.lang.Exception
Specified by:
replaceValue in interface Setter
Throws:
java.lang.Exception

getValueClass

public java.lang.Class getValueClass(JavaBeanUnmarshaller parent)
Description copied from interface: Setter
Find the expected class of a child object; for example, the declared class of a field or JavaBean property. The actual class of the child object may be derived from this class.

Specified by:
getValueClass in interface Setter
Parameters:
parent - describes the parent object, or null if the parent is not yet known.
Returns:
the expected class of the child object, or null if no particular class is expected.

setValue

protected void setValue(java.lang.StringBuffer data)
Description copied from class: DefaultUnmarshaller
Convert the text and store the resulting data into the object.

Overrides:
setValue in class DefaultUnmarshaller