Interface IMutableNode<N extends IMutableNode<N>>
- Type Parameters:
N- the type of aIMutableNode
- All Superinterfaces:
BlanknessRequestable, FluentMutableOptionalHeaderHolder<N>, FormattedStringRepresentable, Node<N>, OptionalHeaderHolder, Resettable
- All Known Implementing Classes:
AbstractMutableNode, FileNode, MutableNode
public interface IMutableNode<N extends IMutableNode<N>>
extends Node<N>, FluentMutableOptionalHeaderHolder<N>, Resettable
A
IMutableNode is a Node that is mutable.- 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 TypeMethodDescriptionaddChildNode(Node<?> childNode) Adds the given childNode to the currentIMutableNode.addChildNodes(Node<?>... childNodes) Adds the given childNodes to the currentIMutableNode.addChildNodes(Iterable<N2> childNodes) Adds the given childNodes to the currentIMutableNode.addChildNodesFromStrings(Iterable<String> strings) Adds the childNodes from the given strings the currentIMutableNode.addChildNodesFromStrings(String... strings) Adds the childNodes from the given strings to the currentIMutableNode.addPostfixToHeader(String postfix) Adds the given postfix at the end of the header of the currentIMutableNodeif the currentIMutableNodehas a header.addPrefixToHeader(String prefix) Adds the given prefix at the begin of the header of the currentIMutableNodeif the currentIMutableNodehas a header.removeAndGetStoredFirstChildNodeThat(Predicate<Node<?>> selector) Removes and returns the first childNodethe given selector selects from the currentIMutableNode.voidRemoves the childNodes from the currentIMutableNode.voidremoveFirstChildNodeThat(Predicate<Node<?>> selector) Removes the first childNodethe given selector selects from the currentIMutableNode.voidremoveFirstChildNodeWithHeader(String header) Removes the first childNodewith the given header from the currentIMutableNode.voidreplaceFirstChildNodeWithGivenHeaderByGivenNode(String header, Node<?> node) Replaces the first childNodewith the given header from the currentIMutableNodeby the givenNode.voidresetFromFile(String filePath) Resets the currentIMutableNodefrom the file with the given file path.voidresetFromNode(Node<?> node) Resets the currentIMutableNodefrom the given node.voidresetFromString(String string) Resets the currentIMutableNodefrom the given string.setChildNodes(Iterable<? extends Node<?>> childNodes) Resets the childNodes of the currentIMutableNodewith the given childNodes.Methods inherited from interface BlanknessRequestable
isBlankMethods inherited from interface FluentMutableOptionalHeaderHolder
removeHeader, setHeaderMethods inherited from interface FormattedStringRepresentable
formattedStringWillHaveMultipleLines, toFormattedString, toFormattedStringWithIndentationLevel, toFormattedStringWithIndentationLevelAndIndentationSymbol, toFormattedStringWithIndentationLevelAndIndentationSymbolMethods inherited from interface Node
containsChildNode, containsChildNodes, containsChildNodeWithHeader, getChildNodeCount, getChildNodeCount, getChildNodesHeaders, getOptionalStoredFirstChildNode, getSingleChildNodeAsBoolean, getSingleChildNodeAsDouble, getSingleChildNodeAsInt, getSingleChildNodeHeader, getStoredChildNodeAtOneBasedIndex, getStoredChildNodes, getStoredChildNodes, getStoredChildNodesWithHeader, getStoredFirstChildNode, getStoredFirstChildNode, getStoredFirstChildNodeWithHeader, getStoredSingleChildNode, toBoolean, toDouble, toInt, toXml, withNewHeaderMethods inherited from interface OptionalHeaderHolder
getHeader, getHeaderOrEmptyString, getOptionalHeader, hasHeader, hasHeaderMethods inherited from interface Resettable
reset
-
Method Details
-
addChildNode
Adds the given childNode to the currentIMutableNode.- Parameters:
childNode-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if the given childNodes is null
-
addChildNodes
Adds the given childNodes to the currentIMutableNode.- Parameters:
childNodes-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if one of the given childNodes is null
-
addChildNodes
Adds the given childNodes to the currentIMutableNode.- Type Parameters:
N2- the type of the given childNodes- Parameters:
childNodes-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if one of the given childNodes is null
-
addChildNodesFromStrings
Adds the childNodes from the given strings the currentIMutableNode.- Parameters:
strings-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if one of the given strings does not represent aNode
-
addChildNodesFromStrings
Adds the childNodes from the given strings to the currentIMutableNode.- Parameters:
strings-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if the given strings is nullRuntimeException- if one of the given strings does not represent aNode
-
addPostfixToHeader
Adds the given postfix at the end of the header of the currentIMutableNodeif the currentIMutableNodehas a header. Sets the given postfix as the header of the currentIMutableNodeif the currentIMutableNodedoes not have a header- Parameters:
postfix-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if the given postfix is null or blank
-
addPrefixToHeader
Adds the given prefix at the begin of the header of the currentIMutableNodeif the currentIMutableNodehas a header. Sets the given prefix as the header of the currentIMutableNodeif the currentIMutableNodedoes not have a header- Parameters:
prefix-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if the given prefix is null or blank
-
removeAndGetStoredFirstChildNodeThat
Removes and returns the first childNodethe given selector selects from the currentIMutableNode.- Parameters:
selector-- Returns:
- the first child
Nodethe given selector selects from the currentIMutableNode - Throws:
RuntimeException- if the currentIMutableNodedoes not contain a childNodethe given selector selects
-
removeChildNodes
void removeChildNodes()Removes the childNodes from the currentIMutableNode. -
removeFirstChildNodeThat
Removes the first childNodethe given selector selects from the currentIMutableNode.- Parameters:
selector-- Throws:
RuntimeException- if the currentIMutableNodedoes not contain a childNodethe given selector selects
-
removeFirstChildNodeWithHeader
Removes the first childNodewith the given header from the currentIMutableNode.- Parameters:
header-- Throws:
RuntimeException- if the currentIMutableNodedoes not contain a childNodewith the given header
-
replaceFirstChildNodeWithGivenHeaderByGivenNode
Replaces the first childNodewith the given header from the currentIMutableNodeby the givenNode.- Parameters:
header-node-- Throws:
RuntimeException- if the currentIMutableNodedoes not contain a childNodewith the given header
-
resetFromFile
Resets the currentIMutableNodefrom the file with the given file path.- Parameters:
filePath-
-
resetFromNode
Resets the currentIMutableNodefrom the given node.- Parameters:
node-- Throws:
RuntimeException- if the given node is null
-
resetFromString
Resets the currentIMutableNodefrom the given string.- Parameters:
string-- Throws:
RuntimeException- if the given string does not represent aIMutableNode
-
setChildNodes
Resets the childNodes of the currentIMutableNodewith the given childNodes.- Parameters:
childNodes-- Returns:
- the current
IMutableNode - Throws:
RuntimeException- if one of the given childNodes is null
-