com.openharbor.beck.unmarshal
Class GroupUnmarshaller

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

public abstract class GroupUnmarshaller
extends DefaultUnmarshaller

Created by IntelliJ IDEA. User: ilya Date: Oct 5, 2004 Time: 1:06:47 PM To change this template use File | Settings | File Templates.


Field Summary
 
Fields inherited from class com.openharbor.beck.unmarshal.DefaultUnmarshaller
data, documentState, log
 
Constructor Summary
GroupUnmarshaller()
           
 
Method Summary
protected abstract  java.util.Collection getCollection()
           
 int locateChild(Unmarshaller child)
          Returns the index of the child in the specified children collection.
 void removeChildAt(int index)
           
 void removeLastChild()
           
 void swapLastChildWith(int childIndex)
           
 
Methods inherited from class com.openharbor.beck.unmarshal.DefaultUnmarshaller
addChild, addToParent, addValue, afterEndObject, disengage, disengaged, endElement, endObject, engage, getChildClass, getMap, getMapFromXML, getObject, getObjectClass, getParent, getSource, getSourceXPath, getXMLContext, getXName, getXPath, isEngaged, newObject, processAttributes, referToThis, reset, rethrow, setMapFromXML, setObject, setObjectClass, setParentAndSource, setValue, setXMLContext, startElement, startObject, toString, trim
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupUnmarshaller

public GroupUnmarshaller()
Method Detail

getCollection

protected abstract java.util.Collection getCollection()

removeChildAt

public void removeChildAt(int index)

removeLastChild

public void removeLastChild()

swapLastChildWith

public void swapLastChildWith(int childIndex)

locateChild

public int locateChild(Unmarshaller child)
                throws java.lang.Exception
Returns the index of the child in the specified children collection. Iterated through the collection until the child is found, and returns the index. Of course, to do anything with the child the caller will have to once again iterate through the collection - wish collections were lists...

The way the child is located is this: we're matching the attribute of the OHXPath node to the attributes of the children. If no attributes are specified in the OHXPath, we try to match the class name. If that slo doesnt happen, an exception is thrown

todo: verify thats indeed the desired behavior

Parameters:
child - the child to be located
Returns:
index of the child in the collection or -1 if not found
Throws:
java.lang.Exception