public class InternalNode extends Object implements MutableNode
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,InternalNode> |
children |
static String |
PRIMARY_TYPE_PROPERTY_NAME |
protected Map<String,Object> |
properties |
PATH_SEPARATOR, ROOT_PATH| Modifier and Type | Method and Description |
|---|---|
InternalNode |
addChild(String nodeName,
InternalNode node) |
InternalNode |
addNode(String relativePath)
Adds a node to the relative path.
|
InternalNode |
addStandAloneChild(InternalNode node) |
<T> void |
addTypedProperty(String property,
T value) |
InternalNode |
createPath(String relativePath)
Add a new, empty node to this node.
|
String |
getName()
Returns the name of the node.
|
Node |
getNode(String relativePath)
Retrieves a node based on a relative path to the current node.
|
protected com.endeca.store.configuration.InternalNode.EndecaNodeInfo |
getNodeInfo(String relativePath) |
Collection<Node> |
getNodes()
Get all the direct child nodes.
|
Node |
getParent()
Returns the parent node.
|
String |
getPath()
Returns the path of the node.
|
String |
getPrimaryType()
Get the value for the property that represents the primary type of this
node.
|
Map<String,Object> |
getProperties()
Returns a Map of all the property names and their values.
|
static Node |
getStandaloneNode(String name)
Get a standalone node, one that will not be added
to an Store.
|
<T> T |
getTypedProperty(String key)
Retrieve a property of this Node.
|
boolean |
hasNode(String relativePath)
Checks to see if a node exists at the current path.
|
boolean |
hasNodes()
Checks if the current node has any child nodes.
|
boolean |
hasProperty(String property)
Checks to see if the current node has a property set.
|
InternalNode |
lazilyAddNodes(String relativePath)
Rather than reconstructing the Jackson Protocol immediately, we'll
lazily create nodes.
|
protected InternalNode |
removeChild(String nodeName) |
void |
removeNode(String relativePath) |
void |
setPrimaryType(String primaryType)
Set the primary type of this node.
|
void |
setProperties(Map<String,Object> properties) |
void |
setProperty(String key,
Object value)
Set the value of the given property.
|
public static String PRIMARY_TYPE_PROPERTY_NAME
protected Map<String,InternalNode> children
public static Node getStandaloneNode(String name)
name - The name of the standalone node.public InternalNode addNode(String relativePath) throws NodeExistsException, PathNotFoundException
relativePath - The relative path to where the node should be created.NodeExistsException - Thrown if the node already exists.PathNotFoundException - If any part of the path does not exist to
the node being added, this exception will be thrown.public void removeNode(String relativePath) throws PathNotFoundException
PathNotFoundExceptionpublic InternalNode createPath(String relativePath) throws BadPathException, PathNotFoundException
relativePath - The path from this node to the newly
created node.BadPathExceptionPathNotFoundExceptionpublic InternalNode lazilyAddNodes(String relativePath) throws PathNotFoundException
relativePath - The relative path to where the node should be created.PathNotFoundExceptionpublic <T> void addTypedProperty(String property, T value)
public String getName()
Nodepublic Node getNode(String relativePath) throws PathNotFoundException
Nodenode2.getNode("node3/node4")node2.getNode("../nodeX/nodeY")node2.getNode("node3/../nodeX")node2.getParent().getNode("nodeX/nodeY")getNode in interface NoderelativePath - The path to the desired node, relative to the current
nodes location.PathNotFoundException - Thrown if any element of the requested
relative path is not valid.public Collection<Node> getNodes()
Nodepublic Node getParent()
Nodepublic String getPath()
Nodepublic Map<String,Object> getProperties()
NodegetProperties in interface Nodepublic <T> T getTypedProperty(String key)
NodeClassCastException.getTypedProperty in interface NodeT - The type of property being retrieved.key - The name of the property on the node.public void setProperty(String key, Object value)
MutableNodesetProperty in interface MutableNodekey - The key of the property.value - The value to set.public String getPrimaryType()
MutableNodegetPrimaryType in interface MutableNodepublic void setPrimaryType(String primaryType)
MutableNodesetPrimaryType in interface MutableNodeprimaryType - The primary type.public boolean hasNode(String relativePath)
Nodepublic boolean hasNodes()
Nodepublic boolean hasProperty(String property)
NodehasProperty in interface Nodeproperty - The name of the property for this node.public InternalNode addChild(String nodeName, InternalNode node)
public InternalNode addStandAloneChild(InternalNode node)
protected InternalNode removeChild(String nodeName)
protected com.endeca.store.configuration.InternalNode.EndecaNodeInfo getNodeInfo(String relativePath) throws PathNotFoundException
PathNotFoundExceptionCopyright © 2013, Oracle and/or its affiliates. All rights reserved.