Package org.jboss.as.cli.operation.impl
Class DefaultOperationRequestAddress
- java.lang.Object
-
- org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress
-
- All Implemented Interfaces:
Iterable<OperationRequestAddress.Node>,OperationRequestAddress
public class DefaultOperationRequestAddress extends Object implements OperationRequestAddress
This implementation is not thread-safe.- Author:
- Alexey Loubyansky
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.as.cli.operation.OperationRequestAddress
OperationRequestAddress.Node
-
-
Constructor Summary
Constructors Constructor Description DefaultOperationRequestAddress()DefaultOperationRequestAddress(OperationRequestAddress initial)Creates a prefix and initializes it to the value of the argument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendPath(OperationRequestAddress path)Appends the path to the current address.booleanendsOnType()Checks whether the prefix ends on a node type or a node name.booleanequals(Object obj)StringgetNodeName()Returns the node name of the last node.StringgetNodeType()Returns the node type of the last node.inthashCode()booleanisEmpty()Checks whether the prefix is empty.Iterator<OperationRequestAddress.Node>iterator()intlength()Returns the number of nodes (more specifically node types, if the address ends on a type, it means the last node is not complete, but it will be counted as a node by this method).voidreset()Resets the prefix, i.e. this will make the prefix empty.voidtoNode(String nodeName)Appends the node name to the current address.voidtoNode(String nodeType, String nodeName)Appends the node to the current address.StringtoNodeType()Sets the current prefix to the node type of the current node, i.e. the node name is removed from the end of the prefix.voidtoNodeType(String nodeType)Appends the node type to the current address.OperationRequestAddress.NodetoParentNode()Removes the last node in the prefix, i.e. moves the value a node up.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DefaultOperationRequestAddress
public DefaultOperationRequestAddress()
-
DefaultOperationRequestAddress
public DefaultOperationRequestAddress(OperationRequestAddress initial)
Creates a prefix and initializes it to the value of the argument.- Parameters:
initial- the initial value
-
-
Method Detail
-
toNodeType
public void toNodeType(String nodeType)
Description copied from interface:OperationRequestAddressAppends the node type to the current address. Note, the current address must end on a node name before this method is invoked.- Specified by:
toNodeTypein interfaceOperationRequestAddress- Parameters:
nodeType- the node type to append to the current address
-
toNode
public void toNode(String nodeName)
Description copied from interface:OperationRequestAddressAppends the node name to the current address. Note, the current address must end on a node type before this method is invoked.- Specified by:
toNodein interfaceOperationRequestAddress- Parameters:
nodeName- the node name to append to the current address
-
toNode
public void toNode(String nodeType, String nodeName)
Description copied from interface:OperationRequestAddressAppends the node to the current address. Note, the current address must end on a node (i.e. node name) before this method is invoked.- Specified by:
toNodein interfaceOperationRequestAddress- Parameters:
nodeType- the node type of the node to append to the current addressnodeName- the node name of the node to append to the current address
-
appendPath
public void appendPath(OperationRequestAddress path)
Description copied from interface:OperationRequestAddressAppends the path to the current address. Note, the current address must end on a node (i.e. node name) before this method is invoked.- Specified by:
appendPathin interfaceOperationRequestAddress- Parameters:
path- the path to append to the current address
-
toNodeType
public String toNodeType()
Description copied from interface:OperationRequestAddressSets the current prefix to the node type of the current node, i.e. the node name is removed from the end of the prefix.- Specified by:
toNodeTypein interfaceOperationRequestAddress- Returns:
- the node name the prefix ended on
-
toParentNode
public OperationRequestAddress.Node toParentNode()
Description copied from interface:OperationRequestAddressRemoves the last node in the prefix, i.e. moves the value a node up.- Specified by:
toParentNodein interfaceOperationRequestAddress- Returns:
- the node the prefix ended on
-
reset
public void reset()
Description copied from interface:OperationRequestAddressResets the prefix, i.e. this will make the prefix empty.- Specified by:
resetin interfaceOperationRequestAddress
-
endsOnType
public boolean endsOnType()
Description copied from interface:OperationRequestAddressChecks whether the prefix ends on a node type or a node name.- Specified by:
endsOnTypein interfaceOperationRequestAddress- Returns:
- true if the prefix ends on a node type, otherwise false.
-
isEmpty
public boolean isEmpty()
Description copied from interface:OperationRequestAddressChecks whether the prefix is empty.- Specified by:
isEmptyin interfaceOperationRequestAddress- Returns:
- true if the prefix is empty, otherwise false.
-
length
public int length()
Description copied from interface:OperationRequestAddressReturns the number of nodes (more specifically node types, if the address ends on a type, it means the last node is not complete, but it will be counted as a node by this method).- Specified by:
lengthin interfaceOperationRequestAddress- Returns:
- the number of nodes this address consists of
-
iterator
public Iterator<OperationRequestAddress.Node> iterator()
- Specified by:
iteratorin interfaceIterable<OperationRequestAddress.Node>
-
getNodeType
public String getNodeType()
Description copied from interface:OperationRequestAddressReturns the node type of the last node.- Specified by:
getNodeTypein interfaceOperationRequestAddress- Returns:
- the node type of the last node or null if the prefix is empty.
-
getNodeName
public String getNodeName()
Description copied from interface:OperationRequestAddressReturns the node name of the last node.- Specified by:
getNodeNamein interfaceOperationRequestAddress- Returns:
- the node name of the last node or null if the prefix ends on a type or is empty.
-
-