ERXRestRequestNode Class Reference

Inherits com::webobjects::foundation::NSKeyValueCoding, and com::webobjects::foundation::NSKeyValueCodingAdditions.

Collaboration diagram for ERXRestRequestNode:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void addChild (ERXRestRequestNode child)
Object associatedObject ()
Object attributeForKey (String key)
Object attributeOrChildNodeValue (String name)
NSDictionary< String, Object > attributes ()
ERXRestRequestNode childNamed (String name)
NSArray< ERXRestRequestNodechildren ()
ERXRestRequestNode cloneNode ()
Object createObjectWithFilter (String entityName, ERXKeyFilter keyFilter, IERXRestDelegate delegate)
 ERXRestRequestNode (String name, Object value, boolean rootNode)
 ERXRestRequestNode (String name, boolean rootNode)
Object id ()
boolean isArray ()
boolean isNull ()
boolean isRootNode ()
String name ()
Object objectWithFilter (String entityName, ERXKeyFilter keyFilter, IERXRestDelegate delegate)
Object removeAttributeForKey (String key)
Object removeAttributeOrChildNodeNamed (String name)
ERXRestRequestNode removeChildNamed (String name)
void setArray (boolean array)
void setAssociatedObject (Object associatedObject)
void setAttributeForKey (Object attribute, String key)
void setID (Object id)
void setName (String name)
void setNull (boolean isNull)
void setRootNode (boolean rootNode)
void setType (String type)
void setValue (Object value)
void takeValueForKey (Object value, String key)
void takeValueForKeyPath (Object value, String keyPath)
Object toJavaCollection (ERXRestFormat.Delegate delegate, Map< Object, ERXRestRequestNode > conversionMap)
Object toJavaCollection (ERXRestFormat.Delegate delegate)
Object toNSCollection (ERXRestFormat.Delegate delegate)
String toString (IERXRestWriter writer, ERXRestFormat.Delegate delegate)
String toString (ERXRestFormat format)
String toString ()
String type ()
void updateObjectWithFilter (Object obj, ERXKeyFilter keyFilter, IERXRestDelegate delegate)
Object value ()
Object valueForKey (String key)
Object valueForKeyPath (String keyPath)

Static Public Member Functions

static ERXRestRequestNode requestNodeWithObjectAndFilter (Object obj, ERXKeyFilter keyFilter, IERXRestDelegate delegate)
static ERXRestRequestNode requestNodeWithObjectAndFilter (EOClassDescription classDescription, List<?> objects, ERXKeyFilter keyFilter, IERXRestDelegate delegate)

Protected Member Functions

void _addAttributeNodeForKeyInObject (ERXKey<?> key, Object obj, ERXKeyFilter keyFilter)
void _addAttributesAndRelationshipsForObjectOfEntity (Object obj, EOClassDescription classDescription, ERXKeyFilter keyFilter, IERXRestDelegate delegate, Set< Object > visitedObjects)
void _addToManyRelationshipNodeForKeyOfEntityInObject (ERXKey<?> key, EOClassDescription destinationEntity, Object obj, ERXKeyFilter keyFilter, IERXRestDelegate delegate, Set< Object > visitedObjects)
void _addToOneRelationshipNodeForKeyInObject (ERXKey<?> key, Object obj, EOClassDescription destinationEntity, ERXKeyFilter keyFilter, IERXRestDelegate delegate, Set< Object > visitedObjects)
void _fillInWithObjectAndFilter (Object obj, EOClassDescription classDescription, ERXKeyFilter keyFilter, IERXRestDelegate delegate, Set< Object > visitedObjects)
void _safeDidSkipValueForKey (ERXKeyFilter keyFilter, Object target, Object value, String key)
void _safeDidTakeValueForKey (ERXKeyFilter keyFilter, Object target, Object value, String key)
void _safeWillTakeValueForKey (ERXKeyFilter keyFilter, Object target, Object value, String key)
void guessNull ()
boolean isClassProperty (EOClassDescription classDescription, String key)
Object toJavaCollection (ERXRestFormat.Delegate delegate, Map< Object, ERXRestRequestNode > conversionMap, Map< Object, Object > associatedObjects)
Object toNSCollection (ERXRestFormat.Delegate delegate, NSMutableDictionary< Object, Object > associatedObjects)
void toString (StringBuffer sb, int depth)

Private Attributes

boolean _array
Object _associatedObject
NSMutableDictionary< String,
Object > 
_attributes
NSMutableArray
< ERXRestRequestNode
_children
Object _id
String _name
boolean _null
boolean _rootNode
String _type
Object _value


Detailed Description

ERXRestRequestNode provides a model of a REST request. Because the incoming document format can vary (XML, JSON, etc), we needed a document model that is more abstract than just an org.w3c.dom. Or, rather, one that isn't obnoxious to use.

Author:
mschrag

Constructor & Destructor Documentation

ERXRestRequestNode ( String  name,
boolean  rootNode 
)

Construct a node with the given name

Parameters:
name the name of this node
rootNode if true, the node is the root of a graph

ERXRestRequestNode ( String  name,
Object  value,
boolean  rootNode 
)

Construct a node with the given name and value.

Parameters:
name the name of this node
rootNode if true, the node is the root of a graph
value the value of this node


Member Function Documentation

void _addAttributeNodeForKeyInObject ( ERXKey<?>  key,
Object  obj,
ERXKeyFilter  keyFilter 
) [protected]

void _addAttributesAndRelationshipsForObjectOfEntity ( Object  obj,
EOClassDescription  classDescription,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate,
Set< Object >  visitedObjects 
) [protected]

void _addToManyRelationshipNodeForKeyOfEntityInObject ( ERXKey<?>  key,
EOClassDescription  destinationEntity,
Object  obj,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate,
Set< Object >  visitedObjects 
) [protected]

void _addToOneRelationshipNodeForKeyInObject ( ERXKey<?>  key,
Object  obj,
EOClassDescription  destinationEntity,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate,
Set< Object >  visitedObjects 
) [protected]

void _fillInWithObjectAndFilter ( Object  obj,
EOClassDescription  classDescription,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate,
Set< Object >  visitedObjects 
) [protected]

void _safeDidSkipValueForKey ( ERXKeyFilter  keyFilter,
Object  target,
Object  value,
String  key 
) [protected]

void _safeDidTakeValueForKey ( ERXKeyFilter  keyFilter,
Object  target,
Object  value,
String  key 
) [protected]

void _safeWillTakeValueForKey ( ERXKeyFilter  keyFilter,
Object  target,
Object  value,
String  key 
) [protected]

void addChild ( ERXRestRequestNode  child  ) 

Adds a child to this node.

Parameters:
child the child to add

Object associatedObject (  ) 

Returns the original object associated with this node.

Returns:
the original object associated with this node

Object attributeForKey ( String  key  ) 

Returns the attribute value for the given key.

Parameters:
key the key
Returns:
the attribute value

Object attributeOrChildNodeValue ( String  name  ) 

Returns the type of this node.

Returns:
the type of this node

NSDictionary<String, Object> attributes (  ) 

Returns the attributes dictionary for this node.

Returns:
the attributes dictionary

ERXRestRequestNode childNamed ( String  name  ) 

Returns the first child named 'name'.

Parameters:
name the name to look for
Returns:
the first child with this name (or null if not found)

NSArray<ERXRestRequestNode> children (  ) 

Returns the children of this node.

Returns:
the children of this node

ERXRestRequestNode cloneNode (  ) 

Clones this node.

Returns:
a clone of this node

Object createObjectWithFilter ( String  entityName,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate 
)

Creates a new instance of an object represented by this request node.

Parameters:
entityName the entity name of the object to use
keyFilter the filter to use for determining which keys can be updated (or null for no update)
delegate the delegate to use
Returns:
a new instance of an object represented by this request node

void guessNull (  )  [protected]

Object id (  ) 

Returns the ID associated with this node.

Returns:
the ID associated with this node

boolean isArray (  ) 

Return whether or not this node represents an array or to-many relationship.

Returns:
whether or not this node represents an array or to-many relationship

boolean isClassProperty ( EOClassDescription  classDescription,
String  key 
) [protected]

boolean isNull (  ) 

Returns whether or not this node represents a null value.

Returns:
true whether or not this node represents a null value

boolean isRootNode (  ) 

Returns whether or not this is a root node (a root node is one that would typically have a node name that is an entity name -- the actual root, or elements in an array, for instance).

Returns:
whether or not this is a root node

String name (  ) 

Returns the name of this node.

Returns:
the name of this node

Object objectWithFilter ( String  entityName,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate 
)

Returns the object that this request node represents.

Parameters:
entityName the entity name of the object to use
keyFilter the filter to use for determining which keys can be updated (or null for no update)
delegate the delegate to use
Returns:
the object that this request node represents

Object removeAttributeForKey ( String  key  ) 

Removes the attribute that has the given name.

Parameters:
key the name of the attribute to remove
Returns:
the attribute value

Object removeAttributeOrChildNodeNamed ( String  name  ) 

Removes the attribute or child node that has the given name (and returns it).

Parameters:
name the name of the attribute or node to remove
Returns:
the removed attribute value

ERXRestRequestNode removeChildNamed ( String  name  ) 

Removes the child name that has the given name.

Parameters:
name the name of the node to remove
Returns:
the node that was removed

static ERXRestRequestNode requestNodeWithObjectAndFilter ( Object  obj,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate 
) [static]

Creates a hierarchy of ERXRestRequestNodes based off of the given object.

Parameters:
obj the object to turn into request nodes
keyFilter the filter to use
Returns:
the root ERXRestRequestNode

static ERXRestRequestNode requestNodeWithObjectAndFilter ( EOClassDescription  classDescription,
List<?>  objects,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate 
) [static]

Creates a hierarchy of ERXRestRequestNodes based off of the given array of objects.

Parameters:
classDescription the entity type of the objects in the array
objects the array to turn into request nodes
keyFilter the filter to use
Returns:
the root ERXRestRequestNode

void setArray ( boolean  array  ) 

Sets whether or not this node represents an array or to-many relationship.

Parameters:
array whether or not this node represents an array or to-many relationship

void setAssociatedObject ( Object  associatedObject  ) 

Sets the original object associated with this node.

Parameters:
associatedObject the original object associated with this node

void setAttributeForKey ( Object  attribute,
String  key 
)

Sets the attribute value for the given key.

Parameters:
attribute the attribute value
key the key

void setID ( Object  id  ) 

Sets the ID associated with this node.

Parameters:
id the ID associated with this node

void setName ( String  name  ) 

Sets the name of this node.

Parameters:
name the name of this node

void setNull ( boolean  isNull  ) 

Sets whether or not this node represents a null value.

Parameters:
isNull whether or not this node represents a null value

void setRootNode ( boolean  rootNode  ) 

Sets whether or not this is a root node (a root node is one that would typically have a node name that is an entity name -- the actual root, or elements in an array, for instance).

Parameters:
rootNode whether or not this is a root node

void setType ( String  type  ) 

Sets the type of this node (type as in the Class that it represents).

Parameters:
type the type of this node

void setValue ( Object  value  ) 

Sets the value for this node.

Parameters:
value the value for this node

void takeValueForKey ( Object  value,
String  key 
)

void takeValueForKeyPath ( Object  value,
String  keyPath 
)

Object toJavaCollection ( ERXRestFormat.Delegate  delegate,
Map< Object, ERXRestRequestNode conversionMap,
Map< Object, Object >  associatedObjects 
) [protected]

Returns the Java object that corresponds to this node hierarchy.

Parameters:
delegate the format delegate to notify during rendering
conversionMap the conversion map to use to record object => request node mappings
associatedObjects the associatedObjects map (to prevent infinite loops)
Returns:
the Java object that corresponds to this node hierarchy

Object toJavaCollection ( ERXRestFormat.Delegate  delegate,
Map< Object, ERXRestRequestNode conversionMap 
)

Returns the Java object that corresponds to this node hierarchy.

Parameters:
delegate the format delegate to notify during rendering
conversionMap the conversion map to use to record object => request node mappings
Returns:
the Java object that corresponds to this node hierarchy

Object toJavaCollection ( ERXRestFormat.Delegate  delegate  ) 

Returns the Java object that corresponds to this node hierarchy.

Parameters:
delegate the format delegate to notify during rendering
Returns:
the Java object that corresponds to this node hierarchy

Object toNSCollection ( ERXRestFormat.Delegate  delegate,
NSMutableDictionary< Object, Object >  associatedObjects 
) [protected]

Returns the NSCollection/Java object that corresponds to this node hierarchy.

Parameters:
associatedObjects the associatedObjects map (to prevent infinite loops)
Returns:
NSCollection/Java object that corresponds to this node hierarchy

Object toNSCollection ( ERXRestFormat.Delegate  delegate  ) 

Returns the NSCollection/Java object that corresponds to this node hierarchy.

Returns:
the NSCollection/Java object that corresponds to this node hierarchy

String toString ( IERXRestWriter  writer,
ERXRestFormat.Delegate  delegate 
)

Returns a string representation of this request node using the given IERXRestWriter.

Parameters:
writer the writer to use
Returns:
a string representation of this request node using the given IERXRestWriter

String toString ( ERXRestFormat  format  ) 

Returns a string representation of this request node using the given format.

Parameters:
format the format to use
Returns:
a string representation of this request node using the given format

void toString ( StringBuffer  sb,
int  depth 
) [protected]

String toString (  ) 

String type (  ) 

Returns the type of this node (type as in the Class that it represents).

Returns:
the type of this node

void updateObjectWithFilter ( Object  obj,
ERXKeyFilter  keyFilter,
IERXRestDelegate  delegate 
)

Updates the given object based on this request node.

Parameters:
obj the object to update
keyFilter the filter to use to determine how to update
delegate the delegate

Object value (  ) 

Returns the value for this node (or null if it doesn't exist).

Returns:
the name of this node

Object valueForKey ( String  key  ) 

Object valueForKeyPath ( String  keyPath  ) 


Member Data Documentation

boolean _array [private]

Object _associatedObject [private]

Object _id [private]

String _name [private]

boolean _null [private]

boolean _rootNode [private]

String _type [private]

Object _value [private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:27 2012 for Project Wonder by  doxygen 1.5.8