Interface Node<N extends Node<N>>
- Type Parameters:
N- the type of aNode
- All Superinterfaces:
BlanknessRequestable, FormattedStringRepresentable, OptionalHeaderHolder
- All Known Subinterfaces:
IMutableNode<N>
- All Known Implementing Classes:
AbstractMutableNode, AbstractNode, FileNode, ImmutableNode, MutableNode
public interface Node<N extends Node<N>>
extends BlanknessRequestable, FormattedStringRepresentable, OptionalHeaderHolder
A
Node can have a header and contain an arbitrary number of child
Nodes.
A Node that does not have a header and does not contain any child
Node is blank.- Author:
- Silvan Wyss
-
Field Summary
Fields inherited from interface FormattedStringRepresentable
DEFAULT_IDENTATION_LEVEL, DEFAULT_IDENTTATION_SYMBOL, DEFAULT_START_MULTILINER_WITH_IDENTATION_FLAG -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsChildNode(Predicate<Node<?>> selector) booleanbooleancontainsChildNodeWithHeader(String header) intintgetChildNodeCount(Predicate<Node<?>> selector) getOptionalStoredFirstChildNode(Predicate<Node<?>> selector) booleandoubleintgetStoredChildNodeAtOneBasedIndex(int oneBasedIndex) getStoredChildNodes(Predicate<Node<?>> selector) getStoredChildNodesWithHeader(String header) getStoredFirstChildNode(Predicate<Node<?>> selector) booleandoubletoDouble()inttoInt()IXmlNode<?> toXml()Node<?> withNewHeader(String header) Methods inherited from interface BlanknessRequestable
isBlankMethods inherited from interface FormattedStringRepresentable
formattedStringWillHaveMultipleLines, toFormattedString, toFormattedStringWithIndentationLevel, toFormattedStringWithIndentationLevelAndIndentationSymbol, toFormattedStringWithIndentationLevelAndIndentationSymbolMethods inherited from interface OptionalHeaderHolder
getHeader, getHeaderOrEmptyString, getOptionalHeader, hasHeader, hasHeader
-
Method Details
-
containsChildNode
-
containsChildNodes
-
containsChildNodeWithHeader
-
getChildNodeCount
-
getChildNodeCount
- Parameters:
selector-- Returns:
- the number of child
Nodes the given selector selects from the currentNode - Throws:
RuntimeException- if the given selector is null
-
getChildNodesHeaders
ExtendedIterable<String> getChildNodesHeaders()- Returns:
- the headers of the child
Nodes of the currentNode - Throws:
RuntimeException- if one of the childNodes of the currentNodedoes not have a header
-
getOptionalStoredFirstChildNode
-
getStoredChildNodeAtOneBasedIndex
-
getStoredChildNodes
ExtendedIterable<N> getStoredChildNodes() -
getStoredChildNodes
- Parameters:
selector-- Returns:
- the child
Nodes the given selector selects from the currentNode - Throws:
RuntimeException- if the given selector is null
-
getStoredChildNodesWithHeader
-
getStoredFirstChildNode
-
getStoredFirstChildNode
- Parameters:
selector-- Returns:
- the first child
Nodethe given selector selects from the currentNode - Throws:
RuntimeException- if the given selector is nullRuntimeException- if the currentNodedoes not contain a childNodethe given selector selects
-
getStoredFirstChildNodeWithHeader
-
getStoredSingleChildNode
-
getSingleChildNodeAsBoolean
boolean getSingleChildNodeAsBoolean()- Returns:
- the boolean the single child
Nodeof the currentNoderepresents - Throws:
RuntimeException- if the currentNodedoes not contain childNodes or contains several childNodesRuntimeException- if the single childNodeof the currentNodedoes not represent a boolean
-
getSingleChildNodeAsDouble
double getSingleChildNodeAsDouble()- Returns:
- the double the single child
Nodeof the currentNoderepresents - Throws:
RuntimeException- if the currentNodedoes not contain childNodes or contains several childNodesRuntimeException- if the single childNodeof the currentNodedoes not represent a double
-
getSingleChildNodeAsInt
int getSingleChildNodeAsInt()- Returns:
- the int the single child
Nodeof the currentNoderepresents - Throws:
RuntimeException- if the currentNodedoes not contain childNodes or contains several childNodesRuntimeException- if the single childNodeof the currentNodedoes not represent an int
-
getSingleChildNodeHeader
String getSingleChildNodeHeader()- Returns:
- the header of the single child
Nodeof the currentNode - Throws:
RuntimeException- if the currentNodedoes not contain childNodes or contains several childNodesRuntimeException- if the single childNodeof the currentNodedoes not have a header
-
toBoolean
boolean toBoolean()- Returns:
- the boolean the current
Noderepresents - Throws:
RuntimeException- if the currentNodedoes not represent a boolean
-
toDouble
double toDouble()- Returns:
- the double the current
Noderepresents - Throws:
RuntimeException- if the currentNodedoes not represent a double
-
toInt
int toInt()- Returns:
- the int the current
Noderepresents - Throws:
RuntimeException- if the currentNodedoes not represent an int
-
toXml
-
withNewHeader
- Parameters:
header-- Returns:
- a new
Nodefrom the currentNodewith the given new header - Throws:
RuntimeException- if the given header is null or blank
-