facets.util.datatree
Class TypedNode<V>

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.util.StatefulCore
          extended by facets.util.datatree.TypedNode<V>
All Implemented Interfaces:
Identified, Stateful, Titled, java.io.Serializable
Direct Known Subclasses:
DataNode

public abstract class TypedNode<V>
extends StatefulCore
implements Identified

Defines simple tree node.

A TypedNode has

TypedNode is declared abstract as several key methods are implemented as convenience stubs, some invalid.

See Also:
Serialized Form

Field Summary
static TypedNode NULL_NODE
           
static java.lang.String UNTITLED
          For use when no other value is appropriate for return by StatefulCore.title().
 
Constructor Summary
TypedNode(java.lang.Class valueType, java.lang.String type, java.lang.String title)
          Unique constructor.
 
Method Summary
 TypedNode[] children()
          The node's TypedNode contents.
 java.lang.Object[] contents()
          Return the node's children and values.
 Stateful copyState()
          Invalid stub.
 java.lang.Object identity()
          Return an object that is as far as possible unique for the implementation.
 TypedNode parent()
          Returns the node's parent.
 void setParent(TypedNode parent)
          Set the node to be returned by parent().
 void setState(java.lang.Object src)
          Invalid stub.
 void setValidType(java.lang.String type)
          Validates and sets the string to be returned by type().
 java.lang.String toString()
          Re-implementation wrapping Debug.info(Object).
 java.lang.String type()
          String suggestive of nature of content tree.
 V[] values()
          The node's non-TypedNode contents.
 
Methods inherited from class facets.util.StatefulCore
setTitle, stateEquals, stateStamp, title, updateStateStamp
 
Methods inherited from class facets.util.Tracer
trace, trace, trace, trace, trace, traceDebug, traceDebug, traceObjectText, traceOutput, traceOutputWithClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_NODE

public static final TypedNode NULL_NODE

UNTITLED

public static final java.lang.String UNTITLED
For use when no other value is appropriate for return by StatefulCore.title().

See Also:
Constant Field Values
Constructor Detail

TypedNode

public TypedNode(java.lang.Class valueType,
                 java.lang.String type,
                 java.lang.String title)
Unique constructor.

Parameters:
valueType - enables return from values() matching the type parameter; only implemented for Object and String; cannot be TypedNode itself
type - passed to setValidType(String) for return by type()
title - passed to StatefulCore
Method Detail

setValidType

public final void setValidType(java.lang.String type)
Validates and sets the string to be returned by type().

Parameters:
type - must be usable as XML name

type

public final java.lang.String type()
String suggestive of nature of content tree.

Returns:
string passed successfully to setValidType(String)

children

public final TypedNode[] children()
The node's TypedNode contents.

Complains at null members.


values

public final V[] values()
The node's non-TypedNode contents.

Returns:
an array as specified by the type parameter and type passed to the constructor; complains at null members

contents

public java.lang.Object[] contents()
Return the node's children and values.

Called (via checks for null) by children() and values(); returned array must not be null nor contain any null members; order may be defined in subclasses.

Returns:
by default an empty array.

parent

public TypedNode parent()
Returns the node's parent.

If none set, returns null without complaint.


setParent

public void setParent(TypedNode parent)
Set the node to be returned by parent().

Parameters:
parent - may be null (signifying instance is root of its tree)

copyState

public Stateful copyState()
Invalid stub.

Specified by:
copyState in interface Stateful
Overrides:
copyState in class StatefulCore

setState

public void setState(java.lang.Object src)
Invalid stub.

Specified by:
setState in interface Stateful
Overrides:
setState in class StatefulCore
Parameters:
src - must be non-null and interpretable by the implementation as state information; it will usually be another instance of the Stateful's class.

identity

public java.lang.Object identity()
Description copied from interface: Identified
Return an object that is as far as possible unique for the implementation.

This will usually be a class instance counter.

Specified by:
identity in interface Identified

toString

public java.lang.String toString()
Description copied from class: StatefulCore
Re-implementation wrapping Debug.info(Object).

Overrides:
toString in class StatefulCore