org.nodal.model
Interface Content

All Known Subinterfaces:
MapContent, MapNode, MapNode.Editor, NodeContent, NodeContent.Editor, RecordContent, RecordNode, RecordNode.Editor, SequenceContent, SequenceNode, SequenceNode.Editor
All Known Implementing Classes:
BareContent, BareContent.Editor, BareMap, BareRecord, BareSequence, MapFilter, RecordFilter, SequenceFilter

public interface Content

The Content interface represents access to the content or properties of a Node.

The interface presents a generic approach to accessing such content in a read-only fashion. If the content is to be modified, then the programmer needs access to the NodeContent.Editor interface.

The general access interface presents all nodes as an ordered collection of properties that act as keys to a set of values. These properties can be enumerated with the properties method and their respective values accessed with the value method.

Without access to this interface, a Node is simply a placeholder with an identifier and type.

Author:
Lee Iverson

Nested Class Summary
static interface Content.Editor
          Encapsulates the ability to edit Content objects.
 
Method Summary
 java.lang.Object getValue(java.lang.Object obj)
          Access the property value, given a property.
 Operator invert(Operator op)
          Produce an Operator that would undo the application of op on this Content.
 boolean isValidProperty(java.lang.Object property)
          Check for the validity of a given property value.
 java.util.Iterator properties()
          A sequence of all of the properties currently indexing the contents if this Content.
 int size()
          The number of properties contained in this Content object.
 NodeType type()
          The type of this Content object.
 Getter value(java.lang.Object obj)
          A generic Getter for property values, given a property.
 

Method Detail

type

public NodeType type()
The type of this Content object.

Necessarily a NodeType type, and always a specific instance of MapType, RecordType or SequenceType.


size

public int size()
The number of properties contained in this Content object.


properties

public java.util.Iterator properties()
A sequence of all of the properties currently indexing the contents if this Content.


isValidProperty

public boolean isValidProperty(java.lang.Object property)
Check for the validity of a given property value.

Parameters:
property - the property to be checked
Returns:
true if that value can be used as a property of this Node

value

public Getter value(java.lang.Object obj)
A generic Getter for property values, given a property.

Will throw an exception if the property type is invalid, but not if the property is not available in this Node's content. This way, a value Getter can be established in anticipation of the addition of a property.

Parameters:
obj - the Object that identifies this property

getValue

public java.lang.Object getValue(java.lang.Object obj)
Access the property value, given a property.

Will throw an exception if the property type is invalid, but not if the property is not available in this Node's content. This way, a value Getter can be established in anticipation of the addition of a property.

Parameters:
obj - the Object that identifies this property
Returns:
the value of the property

invert

public Operator invert(Operator op)
                throws InvalidOperator,
                       ConstraintFailure
Produce an Operator that would undo the application of op on this Content.

Throws:
InvalidOperator
ConstraintFailure