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
PathNotFoundException
public InternalNode createPath(String relativePath) throws BadPathException, PathNotFoundException
relativePath
- The path from this node to the newly
created node.BadPathException
PathNotFoundException
public InternalNode lazilyAddNodes(String relativePath) throws PathNotFoundException
relativePath
- The relative path to where the node should be created.PathNotFoundException
public <T> void addTypedProperty(String property, T value)
public String getName()
Node
public Node getNode(String relativePath) throws PathNotFoundException
Node
node2.getNode("node3/node4")
node2.getNode("../nodeX/nodeY")
node2.getNode("node3/../nodeX")
node2.getParent().getNode("nodeX/nodeY")
getNode
in interface Node
relativePath
- 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()
Node
public Node getParent()
Node
public String getPath()
Node
public Map<String,Object> getProperties()
Node
getProperties
in interface Node
public <T> T getTypedProperty(String key)
Node
ClassCastException
.getTypedProperty
in interface Node
T
- The type of property being retrieved.key
- The name of the property on the node.public void setProperty(String key, Object value)
MutableNode
setProperty
in interface MutableNode
key
- The key of the property.value
- The value to set.public String getPrimaryType()
MutableNode
getPrimaryType
in interface MutableNode
public void setPrimaryType(String primaryType)
MutableNode
setPrimaryType
in interface MutableNode
primaryType
- The primary type.public boolean hasNode(String relativePath)
Node
public boolean hasNodes()
Node
public boolean hasProperty(String property)
Node
hasProperty
in interface Node
property
- 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
PathNotFoundException
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.