com.openharbor.beck.set
Class InlineCollectionSetter

java.lang.Object
  extended bycom.openharbor.beck.set.InlineCollectionSetter
All Implemented Interfaces:
Configurable, Setter

public class InlineCollectionSetter
extends java.lang.Object
implements Configurable, Setter

A Setter that adds the child to a Collection contained in the parent. This is useful when there is no XML element corresponding to the Collection; that is, when the XML elements for the members are 'inline' within the element for the parent.


Field Summary
protected  java.util.Map configuration
           
protected  java.lang.String getterName
           
protected static org.apache.commons.logging.Log 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
InlineCollectionSetter()
           
 
Method Summary
 java.util.Map getConfiguration()
           
 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.
 java.lang.Object removeValue(Unmarshaller child, java.lang.Object[] getterParameters)
           
 java.lang.Object replaceValue(Unmarshaller child, java.lang.Object[] getterParameters)
           
 void setConfiguration(java.util.Map configuration)
           
 void setValue(Unmarshaller child, java.lang.Object[] getterParameters)
          Create a relationship from parent to child.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG

configuration

protected java.util.Map configuration

getterName

protected java.lang.String getterName
Constructor Detail

InlineCollectionSetter

public InlineCollectionSetter()
Method Detail

getConfiguration

public java.util.Map getConfiguration()
Specified by:
getConfiguration in interface Configurable

setConfiguration

public void setConfiguration(java.util.Map configuration)
Specified by:
setConfiguration in interface Configurable

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.

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

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