public class ERXRestRequestNode extends Object implements NSKeyValueCoding, NSKeyValueCodingAdditions
Name | Description |
---|---|
| Boolean property to enable null values in return. Defaults to true. |
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
NullValue
Constructor and Description |
---|
ERXRestRequestNode()
Constructs a new root node with no name.
|
ERXRestRequestNode(String name,
boolean rootNode)
Construct a node with the given name
|
ERXRestRequestNode(String name,
Object value,
boolean rootNode)
Construct a node with the given name and value.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addAttributeNodeForKeyInObject(ERXKey<?> key,
Object obj,
ERXKeyFilter keyFilter) |
protected void |
_addAttributesAndRelationshipsForObjectOfEntity(Object obj,
EOClassDescription classDescription,
ERXKeyFilter keyFilter,
ERXRestContext context,
Set<Object> visitedObjects) |
protected void |
_addToManyRelationshipNodeForKeyOfEntityInObject(ERXKey<?> key,
EOClassDescription destinationEntity,
Object obj,
ERXKeyFilter keyFilter,
ERXRestContext context,
Set<Object> visitedObjects) |
protected void |
_addToOneRelationshipNodeForKeyInObject(ERXKey<?> key,
Object obj,
EOClassDescription destinationEntity,
ERXKeyFilter keyFilter,
ERXRestContext context,
Set<Object> visitedObjects) |
protected void |
_fillInWithObjectAndFilter(Object obj,
EOClassDescription classDescription,
ERXKeyFilter keyFilter,
ERXRestContext context,
Set<Object> visitedObjects) |
void |
_removeRedundantTypes() |
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) |
void |
addChild(ERXRestRequestNode child)
Adds a child to this node.
|
Object |
associatedObject()
Returns the original object associated with this node.
|
Object |
attributeForKey(String key)
Returns the attribute value for the given key.
|
Object |
attributeOrChildNodeValue(String name)
Returns the type of this node.
|
Map<String,Object> |
attributes()
Returns the attributes dictionary for this node.
|
ERXRestRequestNode |
childAtIndex(int index) |
ERXRestRequestNode |
childNamed(String name)
Returns the first child named 'name'.
|
NSArray<ERXRestRequestNode> |
children()
Returns the children of this node.
|
ERXRestRequestNode |
cloneNode()
Clones this node.
|
Object |
createObject()
Equivalent to createObjectWithFilter(null, ERXKeyFilter.filterWithAllRecursive(), new ERXRestContext());
|
Object |
createObjectWithFilter(String entityName,
ERXKeyFilter keyFilter,
ERXRestContext context)
Creates a new instance of an object represented by this request node.
|
protected String |
entityName(String suggestedEntityName) |
protected void |
guessNull() |
Object |
id()
Returns the ID associated with this node.
|
boolean |
isArray()
Return whether or not this node represents an array or to-many relationship.
|
protected boolean |
isClassProperty(EOClassDescription classDescription,
String key) |
boolean |
isNull()
Returns 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).
|
String |
name()
Returns the name of this node.
|
Object |
object()
Equivalent to objectWithFilter(null, ERXKeyFilter.filterWithAllRecursive(), new ERXRestContext());
|
Object |
objectWithFilter(String entityName,
ERXKeyFilter keyFilter,
ERXRestContext context)
Returns the object that this request node represents.
|
Object |
removeAttributeForKey(String key)
Removes the attribute that has the given name.
|
Object |
removeAttributeOrChildNodeNamed(String name)
Removes the attribute or child node that has the given name (and returns it).
|
ERXRestRequestNode |
removeChildNamed(String name)
Removes the child name that has the given name.
|
static ERXRestRequestNode |
requestNodeWithObjectAndFilter(EOClassDescription classDescription,
List<?> objects,
ERXKeyFilter keyFilter,
ERXRestContext context)
Creates a hierarchy of ERXRestRequestNodes based off of the given array of objects.
|
static ERXRestRequestNode |
requestNodeWithObjectAndFilter(Object obj,
ERXKeyFilter keyFilter,
ERXRestContext context)
Creates a hierarchy of ERXRestRequestNodes based off of the given object.
|
void |
setArray(boolean array)
Sets whether or not this node represents an array or to-many relationship.
|
void |
setAssociatedObject(Object associatedObject)
Sets the original object associated with this node.
|
void |
setAttributeForKey(Object attribute,
String key)
Sets the attribute value for the given key.
|
void |
setID(Object id)
Sets the ID associated with this node.
|
void |
setName(String name)
Sets the name of this node.
|
void |
setNull(boolean isNull)
Sets 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).
|
void |
setType(String type)
Sets the type of this node (type as in the Class that it represents).
|
void |
setValue(Object value)
Sets the value for this node.
|
void |
takeValueForKey(Object value,
String keyName) |
void |
takeValueForKeyPath(Object value,
String keyPath) |
Object |
toJavaCollection(ERXRestFormat.Delegate delegate)
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.
|
protected Object |
toJavaCollection(ERXRestFormat.Delegate delegate,
Map<Object,ERXRestRequestNode> conversionMap,
Map<Object,Object> associatedObjects)
Returns the Java object that corresponds to this node hierarchy.
|
Object |
toNSCollection(ERXRestFormat.Delegate delegate)
Returns the NSCollection/Java object that corresponds to this node hierarchy.
|
protected Object |
toNSCollection(ERXRestFormat.Delegate delegate,
NSMutableDictionary<Object,Object> associatedObjects)
Returns the NSCollection/Java object that corresponds to this node hierarchy.
|
String |
toString() |
String |
toString(ERXRestFormat format,
ERXRestContext context)
Returns a string representation of this request node using the given format.
|
String |
toString(IERXRestWriter writer,
ERXRestFormat.Delegate delegate,
ERXRestContext context)
Returns a string representation of this request node using the given IERXRestWriter.
|
protected void |
toString(StringBuffer sb,
int depth) |
String |
type()
Returns the type of this node (type as in the Class that it represents).
|
void |
updateObject(Object obj)
Equivalent to updateObjectWithFilter(obj, ERXKeyFilter.filterWithAllRecursive(), new ERXRestContext());
|
void |
updateObjectWithFilter(Object obj,
ERXKeyFilter keyFilter,
ERXRestContext context)
Updates the given object based on this request node.
|
Object |
value()
Returns the value for this node (or null if it doesn't exist).
|
Object |
valueForKey(String keyName) |
Object |
valueForKeyPath(String keyPath) |
public ERXRestRequestNode()
public ERXRestRequestNode(String name, boolean rootNode)
name
- the name of this noderootNode
- if true, the node is the root of a graphpublic ERXRestRequestNode cloneNode()
public void setRootNode(boolean rootNode)
rootNode
- whether or not this is a root nodepublic boolean isRootNode()
public Object toJavaCollection(ERXRestFormat.Delegate delegate)
delegate
- the format delegate to notify during renderingpublic Object toJavaCollection(ERXRestFormat.Delegate delegate, Map<Object,ERXRestRequestNode> conversionMap)
delegate
- the format delegate to notify during renderingconversionMap
- the conversion map to use to record object => request node mappingsprotected Object toJavaCollection(ERXRestFormat.Delegate delegate, Map<Object,ERXRestRequestNode> conversionMap, Map<Object,Object> associatedObjects)
delegate
- the format delegate to notify during renderingconversionMap
- the conversion map to use to record object => request node mappingsassociatedObjects
- the associatedObjects map (to prevent infinite loops)public Object toNSCollection(ERXRestFormat.Delegate delegate)
protected Object toNSCollection(ERXRestFormat.Delegate delegate, NSMutableDictionary<Object,Object> associatedObjects)
associatedObjects
- the associatedObjects map (to prevent infinite loops)public void setArray(boolean array)
array
- whether or not this node represents an array or to-many relationshippublic boolean isArray()
public void setAssociatedObject(Object associatedObject)
associatedObject
- the original object associated with this nodepublic Object associatedObject()
public void takeValueForKey(Object value, String keyName)
takeValueForKey
in interface NSKeyValueCoding
public Object valueForKey(String keyName)
valueForKey
in interface NSKeyValueCoding
public Object valueForKeyPath(String keyPath)
valueForKeyPath
in interface NSKeyValueCodingAdditions
public void takeValueForKeyPath(Object value, String keyPath)
takeValueForKeyPath
in interface NSKeyValueCodingAdditions
public ERXRestRequestNode childAtIndex(int index)
public ERXRestRequestNode childNamed(String name)
name
- the name to look forpublic ERXRestRequestNode removeChildNamed(String name)
name
- the name of the node to removepublic void setType(String type)
type
- the type of this nodepublic String type()
public void setID(Object id)
id
- the ID associated with this nodepublic Object id()
public Object removeAttributeOrChildNodeNamed(String name)
name
- the name of the attribute or node to removepublic Object attributeOrChildNodeValue(String name)
name
- the attribute or node nameprotected void guessNull()
public void setNull(boolean isNull)
isNull
- whether or not this node represents a null valuepublic boolean isNull()
public String name()
public void setName(String name)
name
- the name of this nodepublic Object value()
public void setValue(Object value)
value
- the value for this nodepublic void setAttributeForKey(Object attribute, String key)
attribute
- the attribute valuekey
- the keypublic Object removeAttributeForKey(String key)
key
- the name of the attribute to removepublic Object attributeForKey(String key)
key
- the keypublic Map<String,Object> attributes()
public void addChild(ERXRestRequestNode child)
child
- the child to addpublic NSArray<ERXRestRequestNode> children()
protected void toString(StringBuffer sb, int depth)
public Object object()
public Object objectWithFilter(String entityName, ERXKeyFilter keyFilter, ERXRestContext context)
entityName
- the entity name of the object to usekeyFilter
- the filter to use for determining which keys can be updated (or null for no update)context
- the REST contextpublic Object createObject()
public Object createObjectWithFilter(String entityName, ERXKeyFilter keyFilter, ERXRestContext context)
entityName
- the entity name of the object to usekeyFilter
- the filter to use for determining which keys can be updated (or null for no update)context
- the REST contextprotected void _addAttributeNodeForKeyInObject(ERXKey<?> key, Object obj, ERXKeyFilter keyFilter)
protected void _addToManyRelationshipNodeForKeyOfEntityInObject(ERXKey<?> key, EOClassDescription destinationEntity, Object obj, ERXKeyFilter keyFilter, ERXRestContext context, Set<Object> visitedObjects)
protected void _addToOneRelationshipNodeForKeyInObject(ERXKey<?> key, Object obj, EOClassDescription destinationEntity, ERXKeyFilter keyFilter, ERXRestContext context, Set<Object> visitedObjects)
protected void _addAttributesAndRelationshipsForObjectOfEntity(Object obj, EOClassDescription classDescription, ERXKeyFilter keyFilter, ERXRestContext context, Set<Object> visitedObjects)
protected void _fillInWithObjectAndFilter(Object obj, EOClassDescription classDescription, ERXKeyFilter keyFilter, ERXRestContext context, Set<Object> visitedObjects)
public String toString(ERXRestFormat format, ERXRestContext context)
format
- the format to usecontext
- the REST contextpublic String toString(IERXRestWriter writer, ERXRestFormat.Delegate delegate, ERXRestContext context)
writer
- the writer to usecontext
- the REST contextprotected boolean isClassProperty(EOClassDescription classDescription, String key)
protected void _safeWillTakeValueForKey(ERXKeyFilter keyFilter, Object target, Object value, String key)
protected void _safeDidTakeValueForKey(ERXKeyFilter keyFilter, Object target, Object value, String key)
protected void _safeDidSkipValueForKey(ERXKeyFilter keyFilter, Object target, Object value, String key)
public void updateObject(Object obj)
obj
- the object to updatepublic void updateObjectWithFilter(Object obj, ERXKeyFilter keyFilter, ERXRestContext context)
obj
- the object to updatekeyFilter
- the filter to use to determine how to updatecontext
- the REST contextpublic void _removeRedundantTypes()
public static ERXRestRequestNode requestNodeWithObjectAndFilter(EOClassDescription classDescription, List<?> objects, ERXKeyFilter keyFilter, ERXRestContext context)
classDescription
- the entity type of the objects in the arrayobjects
- the array to turn into request nodeskeyFilter
- the filter to usecontext
- the REST contextpublic static ERXRestRequestNode requestNodeWithObjectAndFilter(Object obj, ERXKeyFilter keyFilter, ERXRestContext context)
obj
- the object to turn into request nodeskeyFilter
- the filter to usecontext
- the REST contextCopyright © 2002 – 2024 Project Wonder.