Class ModelNode
- java.lang.Object
-
- com.sun.xml.ws.policy.sourcemodel.ModelNode
-
public final class ModelNode extends Object implements Iterable<ModelNode>, Cloneable
The general representation of a single node within aPolicySourceModelinstance. The model node is created via factory methods of thePolicySourceModelinstance. It may also holdAssertionDatainstance in case its type isModelNode.Type.ASSERTION.- Author:
- Marek Potociar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classModelNode.TypePolicy source model node type enumeration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intchildrenSize()Returns the number of child policy source model nodes.protected ModelNodeclone()ModelNodecreateChildAllNode()Factory method that creates new policy source model node as specified by a factory method name and input parameters.ModelNodecreateChildAssertionNode()Factory method that creates new policy source model node as specified by a factory method name and input parameters.ModelNodecreateChildAssertionNode(AssertionData nodeData)Factory method that creates new policy source model node as specified by a factory method name and input parameters.ModelNodecreateChildAssertionParameterNode()Factory method that creates new policy source model node as specified by a factory method name and input parameters.ModelNodecreateChildExactlyOneNode()Factory method that creates new policy source model node as specified by a factory method name and input parameters.ModelNodecreateChildPolicyNode()Factory method that creates new policy source model node as specified by a factory method name and input parameters.booleanequals(Object obj)AnObject.equals(Object obj)method override.AssertionDatagetNodeData()Returns the data for this policy source model node (if any).PolicySourceModelgetParentModel()Returns the parent policy source model that contains this model node.ModelNodegetParentNode()Returns the parent referenced by this policy source model node.ModelNode.TypegetType()Returns the type of this policy source model node.booleanhasChildren()Returns true if the node has at least one child node.inthashCode()AnObject.hashCode()method override.Iterator<ModelNode>iterator()Iterates through all child nodes.AssertionDatasetOrReplaceNodeData(AssertionData newData)The method may be used to set or replace assertion data set for this node.StringtoString()Returns a string representation of the object.StringBuffertoString(int indentLevel, StringBuffer buffer)A helper method that appends indented string representation of this instance to the input string buffer.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
createChildPolicyNode
public ModelNode createChildPolicyNode()
Factory method that creates new policy source model node as specified by a factory method name and input parameters. Each node is created with respect to its enclosing policy source model.- Returns:
- A new Policy node.
-
createChildAllNode
public ModelNode createChildAllNode()
Factory method that creates new policy source model node as specified by a factory method name and input parameters. Each node is created with respect to its enclosing policy source model.- Returns:
- A new All node.
-
createChildExactlyOneNode
public ModelNode createChildExactlyOneNode()
Factory method that creates new policy source model node as specified by a factory method name and input parameters. Each node is created with respect to its enclosing policy source model.- Returns:
- A new ExactlyOne node.
-
createChildAssertionNode
public ModelNode createChildAssertionNode()
Factory method that creates new policy source model node as specified by a factory method name and input parameters. Each node is created with respect to its enclosing policy source model.- Returns:
- A new policy assertion node.
-
createChildAssertionNode
public ModelNode createChildAssertionNode(AssertionData nodeData)
Factory method that creates new policy source model node as specified by a factory method name and input parameters. Each node is created with respect to its enclosing policy source model.- Parameters:
nodeData- The policy assertion data.- Returns:
- A new policy assertion node.
-
createChildAssertionParameterNode
public ModelNode createChildAssertionParameterNode()
Factory method that creates new policy source model node as specified by a factory method name and input parameters. Each node is created with respect to its enclosing policy source model.- Returns:
- A new assertion parameter node.
-
getParentModel
public PolicySourceModel getParentModel()
Returns the parent policy source model that contains this model node.- Returns:
- the parent policy source model
-
getType
public ModelNode.Type getType()
Returns the type of this policy source model node.- Returns:
- actual type of this policy source model node
-
getParentNode
public ModelNode getParentNode()
Returns the parent referenced by this policy source model node.- Returns:
- current parent of this policy source model node or
nullif the node does not have a parent currently.
-
getNodeData
public AssertionData getNodeData()
Returns the data for this policy source model node (if any). The model node data are expected to be notnullonly in case the type of this node is ASSERTION or ASSERTION_PARAMETER_NODE.- Returns:
- the data of this policy source model node or
nullif the node does not have any data associated to it attached.
-
setOrReplaceNodeData
public AssertionData setOrReplaceNodeData(AssertionData newData)
The method may be used to set or replace assertion data set for this node. If there are assertion data set already, those are replaced by a new reference and eventualy returned from the method.
This method is supported only in case this model node instance's type isASSERTIONorASSERTION_PARAMETER_NODE. If used from other node types, an exception is thrown.- Parameters:
newData- new assertion data to be set.- Returns:
- old and replaced assertion data if any or
nullotherwise. - Throws:
UnsupportedOperationException- in case this method is called on nodes of type other thanASSERTIONorASSERTION_PARAMETER_NODE
-
childrenSize
public int childrenSize()
Returns the number of child policy source model nodes. If this model node contains more thanInteger.MAX_VALUEchildren, returnsInteger.MAX_VALUE.- Returns:
- the number of children of this node.
-
hasChildren
public boolean hasChildren()
Returns true if the node has at least one child node.- Returns:
- true if the node has at least one child node, false otherwise.
-
equals
public boolean equals(Object obj)
AnObject.equals(Object obj)method override. Method ignores the parent source model. It means that two model nodes may be the same even if they belong to different models.
If parent model comparison is desired, it must be accomplished separately. To perform that, the reference equality test is sufficient (nodeA.getParentModel() == nodeB.getParentModel()), since all model nodes are created for specific model instances.
-
hashCode
public int hashCode()
AnObject.hashCode()method override.
-
toString
public String toString()
Returns a string representation of the object. In general, thetoStringmethod returns a string that "textually represents" this object.
-
toString
public StringBuffer toString(int indentLevel, StringBuffer buffer)
A helper method that appends indented string representation of this instance to the input string buffer.- Parameters:
indentLevel- indentation level to be used.buffer- buffer to be used for appending string representation of this instance- Returns:
- modified buffer containing new string representation of the instance
-
clone
protected ModelNode clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
-