org.sapia.archie.impl
Class SingleValueNode

java.lang.Object
  extended by org.sapia.archie.AbstractNode
      extended by org.sapia.archie.impl.SingleValueNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
DefaultNode

public class SingleValueNode
extends AbstractNode

An instance of this class tolerates only one value for a given name.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Field Summary
protected  java.util.Map _values
           
 
Fields inherited from class org.sapia.archie.AbstractNode
_children, _fac
 
Constructor Summary
SingleValueNode(java.util.Map children, java.util.Map values, NodeFactory fac)
           
SingleValueNode(NameParser parser, java.util.Map children, java.util.Map values, NodeFactory fac)
           
 
Method Summary
 java.util.Iterator getEntries()
           
 java.lang.Object getValue(NamePart name)
          Returns this node's value.
 int getValueCount()
          Returns the number of values that this instance contains.
 java.util.Iterator getValueNames()
          Returns the names of this instance's values.
protected  java.lang.Object onRead(NamePart np, java.lang.Object toRead)
           
protected  java.lang.Object onWrite(NamePart np, java.lang.Object o)
           
 boolean putValue(NamePart name, java.lang.Object value, boolean overwrite)
          Put a value into this node; overwrites the existing value - if any.
 java.lang.Object removeValue(NamePart name)
          Internally removes the value that this node holds and returns it.
 
Methods inherited from class org.sapia.archie.AbstractNode
createChild, getAbsolutePath, getChild, getChildren, getChildrenCount, getChildrenNames, getName, getNameParser, getParent, removeChild, setUp, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_values

protected java.util.Map _values
Constructor Detail

SingleValueNode

public SingleValueNode(java.util.Map children,
                       java.util.Map values,
                       NodeFactory fac)
                throws ProcessingException
Throws:
ProcessingException

SingleValueNode

public SingleValueNode(NameParser parser,
                       java.util.Map children,
                       java.util.Map values,
                       NodeFactory fac)
                throws ProcessingException
Throws:
ProcessingException
Method Detail

getValue

public java.lang.Object getValue(NamePart name)
Description copied from interface: Node
Returns this node's value.

Returns:
an Object, or null if this node has no value.
See Also:
Node.getValue(NamePart)

removeValue

public java.lang.Object removeValue(NamePart name)
Description copied from interface: Node
Internally removes the value that this node holds and returns it.

Returns:
an Object, or null if this node has no value.
See Also:
Node.removeValue(NamePart)

putValue

public boolean putValue(NamePart name,
                        java.lang.Object value,
                        boolean overwrite)
Description copied from interface: Node
Put a value into this node; overwrites the existing value - if any.

Parameters:
name - the name under which to bind the given value.
value - an Object.
overwrite - if true, overwrites the already existing value for the given name - it such is the case.
Returns:
true if the given value was added. Returns false if overwrite is false and a value already exists for the given name.
See Also:
Node.putValue(NamePart, Object, boolean)

getValueCount

public int getValueCount()
Description copied from interface: Node
Returns the number of values that this instance contains.

Returns:
the number of values that this instance contains.
See Also:
Node.getValueCount()

getValueNames

public java.util.Iterator getValueNames()
Description copied from interface: Node
Returns the names of this instance's values.

Returns:
an Iterator of NameParts.
See Also:
Node.getValueNames()

getEntries

public java.util.Iterator getEntries()
Returns:
an Iterator of Entry instances, corresponding to the bindings that this instance holds.
See Also:
Node.getEntries()

onRead

protected java.lang.Object onRead(NamePart np,
                                  java.lang.Object toRead)

onWrite

protected java.lang.Object onWrite(NamePart np,
                                   java.lang.Object o)


Copyright © 2010 Sapia OSS. All Rights Reserved.