class DirNode
extends java.lang.Object
childList
)
to store child nodes, not just their names.Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,Attribute> |
attributes
Current node attributes
|
protected java.util.Map<java.lang.String,java.lang.Object> |
childList
List of child nodes
|
private java.lang.String |
name
Node name
|
protected ObjectClass |
nodeClass
Object Class represented by node
|
Constructor and Description |
---|
DirNode(DirNode other)
Constructs node as copy of other node.
|
DirNode(ObjectClass nodeClass,
java.lang.String name)
Constructs an empty node of given class and name.
|
DirNode(java.lang.String className,
java.lang.String name)
Constructs an empty node of given class name and name.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
addAttribute(Attribute attribute)
Add attribute to the node.
|
private void |
addAttributeInt(Attribute attribute)
Convenience method which adds attribute into the set of node attributes.
|
(package private) boolean |
addAttributeValue(java.lang.String attrName,
java.lang.Object value,
boolean initial)
Add new attribute value.
|
(package private) boolean |
addChild(java.lang.String child)
Add a new child node if this is allowed.
|
(package private) boolean |
addStringAttributeValue(java.lang.String attrName,
java.lang.String value)
Add new attribute value using
String as a data source. |
(package private) Attribute |
genAttribute(java.lang.String attrName)
Get existing attribute or generate new empty instance of
Attribute . |
(package private) Attribute |
getAttribute(java.lang.String name)
Get an attribute with specified name.
|
(package private) Attribute[] |
getAttributes()
Get a list of all attributes.
|
(package private) int |
getChildCount()
Get number of children.
|
(package private) java.lang.String[] |
getChildNames()
Get a list of all child node names.
|
(package private) java.lang.String |
getName()
Get node name.
|
(package private) ObjectClass |
getNodeClass()
Get node Object Class.
|
(package private) boolean |
hasChild(java.lang.String name)
Check if child node with specified name exists.
|
(package private) boolean |
isA(java.lang.String className)
Check if node is of specified Object Class.
|
(package private) boolean |
isLeaf()
Check if object class of the node does not allow adding child nodes.
|
(package private) boolean |
isValid()
Verify validness of the node.
|
(package private) boolean |
removeAttribute(java.lang.String name)
Remove attribute with specified name.
|
(package private) boolean |
removeChild(java.lang.String child)
Remove child with specified name.
|
(package private) boolean |
replaceAttributes(Attribute[] attrList)
Add array of attributes to the node.
|
(package private) boolean |
setAttribute(Attribute attribute)
Add or replace attribute with specified one.
|
(package private) boolean |
setAttributeValue(java.lang.String attrName,
java.lang.Object value,
int ndx)
Set new attribute value.
|
(package private) void |
setName(java.lang.String name)
Rename node.
|
private java.util.Map<java.lang.String,Attribute> attributes
protected java.util.Map<java.lang.String,java.lang.Object> childList
private java.lang.String name
protected ObjectClass nodeClass
DirNode(ObjectClass nodeClass, java.lang.String name)
nodeClass
- Object Class of the created node.name
- Node name.DirNode(java.lang.String className, java.lang.String name)
className
- Object Class name of the created node.name
- Node name.DirNode(DirNode other)
other
- DirNode
instance to copy data from.boolean addAttribute(Attribute attribute)
attribute
- Attribute instance to add.true
if operation was successful.boolean replaceAttributes(Attribute[] attrList)
attrList
- List of new node attributes.true
if operation was successful.boolean addAttributeValue(java.lang.String attrName, java.lang.Object value, boolean initial)
attrName
- Attribute namevalue
- Attribute valueinitial
- Allow initialisation of the immutable attributes.
true
if this is initialisation mode.true
if operation was successful.boolean addChild(java.lang.String child)
child
- Child name.true
if operation was successful.boolean addStringAttributeValue(java.lang.String attrName, java.lang.String value)
String
as a data source.attrName
- Attribute namevalue
- Attribute valuetrue
if operation was successful.Attribute genAttribute(java.lang.String attrName)
Attribute
.attrName
- Attribute name.Attribute getAttribute(java.lang.String name)
name
- Name of the attribute to return.null
otherwise.Attribute[] getAttributes()
int getChildCount()
java.lang.String[] getChildNames()
java.lang.String getName()
ObjectClass getNodeClass()
boolean hasChild(java.lang.String name)
name
- Child node name.true
if child with specified name exists.boolean isA(java.lang.String className)
className
- An object class name to compare with.true
if node is of specified object class and
false
otherwise.boolean isValid()
true
if node is valid.boolean removeAttribute(java.lang.String name)
name
- Name of the attribute to remove.true
if operation was successful.boolean setAttribute(Attribute attribute)
attribute
- An attribute to add or replace existing.true
if operation was successful.boolean setAttributeValue(java.lang.String attrName, java.lang.Object value, int ndx)
attrName
- Attribute namevalue
- New value for the attributendx
- Index of the valuetrue
if operation was successful.void setName(java.lang.String name)
name
- New name for the node.boolean isLeaf()
true
if object class is leaf.boolean removeChild(java.lang.String child)
child
- Name of the child to remove.true
if operation was successful.private void addAttributeInt(Attribute attribute)
attribute
- Attribute to add.