|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectNodeImpl
public class NodeImpl
Constructor Summary | |
---|---|
NodeImpl(InstanceComponent component)
|
|
NodeImpl(InstanceComponent component,
Object value)
|
Method Summary | |
---|---|
void |
addAttribute(Node attribute)
|
void |
addChild(Node child)
|
Node |
getAttribute(Class clazz)
Returns the node corresponding to the attribute which has a parsed value which is an instance of clazz . |
Node |
getAttribute(String name)
Returns the node corresonding to the attribute with the specified name. |
List |
getAttributes()
Returns all nodes corresponding to attributes. |
List |
getAttributes(Class clazz)
Returns all nodes corresponding to attributes which has a parsed values which are instances of clazz . |
Object |
getAttributeValue(Class clazz)
Helper method for access to the parsed value of the attribute whose parsed value is an instance of clazz . |
Object |
getAttributeValue(Class clazz,
Object defaultValue)
Helper method for access to the parsed value of the attribute whose parsed value is an instance of clazz , returning a
defaultValue when no such attribute is present. |
Object |
getAttributeValue(String name)
Helper method for access to the parsed value of the attribute with the specified name. |
Object |
getAttributeValue(String name,
Object defaultValue)
Helper method for access to the parsed value of the attribute with the specified name, returning a defaultValue when no such
attribute is present |
List |
getAttributeValues(Class clazz)
Helper method for access ot the parsed values of attribute nodes whose parsed values are instances of clazz . |
Node |
getChild(Class clazz)
Returns a node corresponding to a child element which has a parsed value which is an instance of clazz . |
Node |
getChild(String name)
Returns a node corresponding to a child element. |
List |
getChildren()
Contents of this node. |
List |
getChildren(Class clazz)
Returns all nodes corresponding to child elements with the parsed values that are instances of clazz |
List |
getChildren(String name)
Returns all nodes corresponding child elements with the specified name. |
Object |
getChildValue(Class clazz)
Helper method for access to child's parsed contents by class. |
Object |
getChildValue(Class clazz,
Object defaultValue)
Helper method for access to child's parsed contents by class, returning a defaultValue when no such value is present In the event that the node has multiple children which are instances of clazz , the first is returned, there is no guarantee of
order. |
Object |
getChildValue(int index)
Helper method for access to child's parsed contents. |
Object |
getChildValue(String name)
Helper method for access to child's parsed contents by element name. |
Object |
getChildValue(String name,
Object defaultValue)
Helper method for access to child's parsed contents by element name.returning a defaultValue when no such value is present In the event that the node has multiple children mathing name
the first encountered is returned, there is no guarantee of order. |
List |
getChildValues(Class clazz)
Helper method for access to the set of parsed child values which are instances of the specified class. |
List |
getChildValues(String name)
Helper method for access to the set of parse child values with the specified name. |
InstanceComponent |
getComponent()
|
int |
getNAttributes()
|
int |
getNChildren()
|
Object |
getValue()
|
boolean |
hasAttribute(Class clazz)
Determines if the node has an attribute whose value is of the specified class. |
boolean |
hasAttribute(String name)
Determines if the node has an attribute with the specified name. |
boolean |
hasChild(Class clazz)
Determines if the node has a child whose value is of the specified class. |
boolean |
hasChild(String name)
Determines if the node has a child with the specified name. |
Node |
removeAttribute(String name)
|
void |
removeChild(Node child)
|
Node |
removeChild(String name)
|
void |
setValue(Object value)
Sets the value of the node. |
String |
toString()
|
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NodeImpl(InstanceComponent component)
public NodeImpl(InstanceComponent component, Object value)
Method Detail |
---|
public InstanceComponent getComponent()
getComponent
in interface Node
public Object getValue()
getValue
in interface Node
public void setValue(Object value)
Node
setValue
in interface Node
value
- The new parse value.public boolean hasChild(String name)
Node
hasChild
in interface Node
name
- The name of a child node.
true
if a child node exists with the name, otehrwise false
.public boolean hasChild(Class clazz)
Node
hasChild
in interface Node
clazz
- The class of the child node value.
true
if a child node exists with the class, otherwise false
.public List getChildren()
XXX: either return unmodifeable Collection, or return the collection directly. Client code should make the copy iff they need it. Going to try changing it and see what breaks.
getChildren
in interface Node
Node.getChildren()
public int getNChildren()
public List getChildren(String name)
Node
getChildren
in interface Node
name
- The name of a child element.
public List getChildren(Class clazz)
Node
clazz
getChildren
in interface Node
clazz
- The class of parsed child values.
clazz, or an empty list.
public Node getChild(String name)
Node
getChild
in interface Node
name
- The name of a child element.
public Node getChild(Class clazz)
Node
clazz
. This method returns the
first such node it finds and no order is guarenteed, it is providedd
for convenience. This method returns null if it finds no
such child mathing the above criteria.
- Specified by:
getChild
in interface Node
- Parameters:
clazz
- The class of the parsed value of a child element.
- Returns:
- The first node found, or null.
public boolean hasAttribute(Class clazz)
Node
hasAttribute
in interface Node
clazz
- The class of the attribute value
true
if an attribute exists with the class, otherwise false
.public boolean hasAttribute(String name)
Node
hasAttribute
in interface Node
name
- The name of an attribute
true
if am attribute exists with the name, otehrwise false
.public List getAttributes()
Node
getAttributes
in interface Node
public List getAttributes(Class clazz)
Node
clazz
.
getAttributes
in interface Node
clazz
- The class of parsed attribute values.
clazz
, or an empty list.public int getNAttributes()
public Node getAttribute(String name)
Node
getAttribute
in interface Node
name
- The name of the attribute.public Node getAttribute(Class clazz)
Node
clazz
. In the event that the node
contains multple attributes matching the above criteria, the first
encountered is returned, with no guaratnee of order. For all nodes
matching this criteria use Node.getAttributes(Class)
.
getAttribute
in interface Node
clazz
- The class of parsed attribute values.
clazz
, or null
if no such node exists.public Object getAttributeValue(String name)
Node
getAttributeValue
in interface Node
name
- The name of the attribute in which to retreive the parsed
value from.
null
if no such attribute is found.public Object getAttributeValue(Class clazz)
Node
clazz
. In the event that the
node contains multple attributes matching the above criteria, the first
encountered is returned, with no guaratnee of order. For all values
matching this criteria use Node.getAttributeValues(Class)
.
getAttributeValue
in interface Node
clazz
- The class of parsed attribute values.
null
if no such attribute is found.public List getAttributeValues(Class clazz)
Node
clazz
.
getAttributeValues
in interface Node
clazz
- The class of parsed attribute values.
clazz
, or an empty list.public String toString()
toString
in class Object
public Object getChildValue(int index)
Node
Should be in the range of getChildren().size()
Simple helper method for the contents of getChildren:
return ((Node)getChildren.get( index )).getValue();
getChildValue
in interface Node
public Object getChildValue(String name)
Node
In the event that the node has multiple children mathing name
the first encountered is returned, there is no guarantee of order. For a
list of all values matching name use
Node.getChildValues(String)
.
getChildValue
in interface Node
name
- The name of the child which parsed content is to be retrived.
null
if the child does not exist.public Object getChildValue(Class clazz)
Node
In the event that the node has multiple children which are instances of
clazz
, the first is returned, there is no guarantee of
order. For a list of all values which are instances of clazz
use Node.getChildValues(Class)
.
getChildValue
in interface Node
clazz
- The class of parsed child value.
clazz
,
or null
if no such child exists.public List getChildValues(String name)
Node
getChildValues
in interface Node
name
- The name of the child element in which to retreive the
parsed value.
public List getChildValues(Class clazz)
Node
getChildValues
in interface Node
clazz
- The class of the child values.
class,
or an empty list if no such values exist.
public Object getAttributeValue(String name, Object defaultValue)
Node
defaultValue
when no such
attribute is present
getAttributeValue
in interface Node
name
- The name of the attribute in which to retreive the parsed
value from.defaultValue
- A defaultValue to return, if no such attribute
found.
defaultValue
if no such attribute is found.public Object getAttributeValue(Class clazz, Object defaultValue)
Node
clazz
, returning a
defaultValue
when no such attribute is present. In the event
that the node contains multple attributes matching the above criteria, the
first encountered is returned, with no guaratnee of order. For all values
matching this criteria use Node.getAttributeValues(Class)
.
getAttributeValue
in interface Node
clazz
- The class of parsed attribute values.defaultValue
- A defaultValue to return, if no such attribute
found.
defaultValue
if no such attribute is found.public Object getChildValue(String name, Object defaultValue)
Node
In the event that the node has multiple children mathing name
the first encountered is returned, there is no guarantee of order. For a
list of all values matching name use
Node.getChildValues(String)
.
getChildValue
in interface Node
name
- The name of the child which parsed content is to be retrived.defaultValue
- A defaultValue to return, if no such child found.
defaultValue
if the child does not exist.public Object getChildValue(Class clazz, Object defaultValue)
Node
In the event that the node has multiple children which are instances of
clazz
, the first is returned, there is no guarantee of
order. For a list of all values which are instances of clazz
use Node.getChildValues(Class)
.
getChildValue
in interface Node
clazz
- The class of parsed child value.defaultValue
- A defaultValue to return, if no such child found.
clazz
,
or defaultValue
if no such child exists.public void addChild(Node child)
public Node removeChild(String name)
public void removeChild(Node child)
public void addAttribute(Node attribute)
public Node removeAttribute(String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |