com.openharbor.beck.set
Interface Setter

All Known Implementing Classes:
ArrayUnmarshaller, BitBucketSetter, ChooseUnmarshaller, CollectionSetter, CollectionUnmarshaller, ContractionUnmarshaller, FieldSetter, InlineCollectionSetter, JavaBeanSetter

public interface Setter

Represents a parent/child relationship between objects; that is, a relationship between two objects that map from nested XML elements.


Method Summary
 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 setValue(Unmarshaller child, java.lang.Object[] setterParameters)
          Create a relationship from parent to child.
 

Method Detail

getValueClass

public 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. The actual class of the child object may be derived from this class.

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

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

Parameters:
child - describes the child object. child.getParent() describes the parent.
setterParameters - 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

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.

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
Throws:
java.lang.Exception

replaceValue

public java.lang.Object replaceValue(Unmarshaller child,
                                     java.lang.Object[] getterParameters)
                              throws java.lang.Exception
Throws:
java.lang.Exception