ANY_NODE, IS_COMMENT, IS_ELEMENT, IS_EMPTY_ELEMENT, IS_IGNORABLE_TEXT, IS_TEXT| Modifier and Type | Method | Description |
|---|---|---|
default <C extends Child> |
addChild(C child) |
Adds a child to this parent.
|
default void |
addChildren(Child... children) |
Adds all children of an array to this parent.
|
default void |
addChildren(java.lang.Iterable<? extends Child> children) |
Adds all children of an Iterable to this parent.
|
default Element |
addElement(java.lang.String name) |
Creates and adds a child element as last child, if possible.
|
boolean |
canAddChild(Child child) |
Returns
true when a child can be added. |
default void |
changeComments(java.util.function.Function<java.lang.String,java.lang.String> modifier) |
Changes all comments locally.
|
default void |
changeComments(java.util.function.Function<java.lang.String,java.lang.String> modifier,
boolean recurse) |
Changes all comments recursively.
|
default void |
changeNamedTexts(java.lang.String name,
java.util.function.Function<java.lang.String,java.lang.String> modifier) |
Changes or set text under element that have a given name, locally.
|
default void |
changeNamedTexts(java.lang.String name,
java.util.function.Function<java.lang.String,java.lang.String> modifier,
boolean recurse) |
Changes or set text under element that have a given name, recursively.
|
default void |
changeTexts(java.util.function.Function<java.lang.String,java.lang.String> modifier) |
Changes all texts locally.
|
default void |
changeTexts(java.util.function.Function<java.lang.String,java.lang.String> modifier,
boolean recurse) |
Changes all texts recursively.
|
Parent |
clone(boolean recurse) |
Return a clone of this node.
|
void |
doAddChild(Child child) |
Implementation.
|
void |
doRemoveChild(Child child) |
Implementation.
|
default <T extends Node> |
getChild(java.lang.Class<T> childClass) |
|
default <T extends Node> |
getChild(java.lang.Class<T> childClass,
java.util.function.Predicate<? super T> predicate) |
|
default Child |
getChildAt(int index) |
Returns the child at a given, index or null.
|
default <T extends Node> |
getChildAt(java.lang.Class<T> childClass,
int index) |
Returns the child that is an instance of a given class and is at a given position.
|
default <T extends Node> |
getChildAt(java.lang.Class<T> childClass,
java.util.function.Predicate<? super T> predicate,
int index) |
Returns the child that is an instance of a given class, matches a Predicate and is at a given position.
|
java.util.List<AbstractChild> |
getChildren() |
|
default <T extends Node> |
getChildren(java.lang.Class<T> childClass) |
Returns an Iterable of children that are instance of a given class.
|
default <T extends Node> |
getChildren(java.lang.Class<T> childClass,
java.util.function.Predicate<? super T> predicate) |
Returns an Iterable of children that are instance of a given class and match a predicate.
|
default int |
getChildrenCount() |
|
default int |
getChildrenCount(java.lang.Class<? extends Node> childClass) |
Returns the number of children that match a class.
|
default <T extends Node> |
getChildrenCount(java.lang.Class<T> childClass,
java.util.function.Predicate<? super T> predicate) |
Returns the number of children that match a class and predicate.
|
default java.lang.Iterable<Comment> |
getComments() |
|
default Element |
getElementNamed(java.lang.String name) |
Returns the first child element that has a given name or
null. |
default Element |
getElementNamedAt(java.lang.String name,
int index) |
Returns the child element that has a given name and index.
|
default Element |
getElementNamedIgnoreCase(java.lang.String name) |
Returns the first child element that has a given name, ignoring case, or
null. |
default Element |
getElementNamedIgnoreCaseAt(java.lang.String name,
int index) |
Returns the child element that has a given name, ignoring case, and index.
|
default Element |
getElementNamedWithAttribute(java.lang.String name,
java.lang.String attributeName,
java.lang.String attributeValue) |
|
default java.lang.Iterable<Element> |
getElements() |
|
default java.lang.Iterable<Element> |
getElementsNamed(java.lang.String name) |
Returns an Iterable of children elements that have a given name.
|
default java.lang.Iterable<Element> |
getElementsNamedIgnoreCase(java.lang.String name) |
Returns an Iterable of children elements that have a given name, ignoring case.
|
default Child |
getLastChild() |
|
default java.lang.Iterable<Text> |
getTexts() |
|
default boolean |
hasChildren() |
|
default boolean |
hasChildren(java.lang.Class<? extends Node> childClass) |
Returns
true if this parent has children of a given class. |
default <T extends Node> |
hasChildren(java.lang.Class<T> childClass,
java.util.function.Predicate<? super T> predicate) |
Returns
true if this parent has children of a given class and matching a predicate. |
default boolean |
hasComments() |
|
default boolean |
hasElements() |
|
default boolean |
hasTexts() |
|
default void |
mergeComments() |
Merges all consecutive comments locally.
|
default void |
mergeComments(boolean recurse) |
Merges all consecutive comments recursively.
|
default void |
mergeTexts() |
Merges all consecutive texts locally.
|
default void |
mergeTexts(boolean recurse) |
Merges all consecutive texts recursively.
|
default boolean |
removeChild(Child child) |
Remove a child.
|
default Child |
removeChildAt(int index) |
Removes the child located at a given index.
|
default void |
removeChildren() |
Removes all children locally.
|
default void |
removeChildren(java.util.function.Predicate<? super Child> predicate) |
Removes all children that match a predicate.
|
default void |
removeChildren(java.util.function.Predicate<? super Child> predicate,
boolean recurse) |
Removes all children that match a predicate, recursively.
|
default void |
removeComments() |
Removes all comments locally.
|
default void |
removeComments(boolean recurse) |
Removes all comments recursively.
|
default void |
removeElementsNamed(java.lang.String name) |
Removes all children elements that have a given name.
|
default void |
removeElementsNamed(java.lang.String name,
boolean recurse) |
Removes all children elements that have a given name, recursively.
|
default void |
removeIgnorableTexts() |
Removes all ignorable texts locally.
|
default void |
removeIgnorableTexts(boolean recurse) |
Removes all ignorable texts recursively.
|
default void |
removeTexts() |
Removes all texts locally.
|
default void |
removeTexts(boolean recurse) |
Removes all texts recursively.
|
default void |
sortChildren(java.util.Comparator<? super Child> comparator) |
Sorts children locally.
|
default void |
sortChildren(java.util.Comparator<? super Child> comparator,
boolean recurse) |
Sorts children recursively.
|
deepEquals, getDocument, getRootElement, getTypeParent clone(boolean recurse)
Nodeboolean canAddChild(Child child)
true when a child can be added.child - The childtrue when child can be added.void doAddChild(Child child)
WARNING: Do not use, this is an implementation detail that may change at any time.
child - The child to add.void doRemoveChild(Child child)
WARNING: Do not use, this is an implementation detail that may change at any time.
child - The child to remove.java.util.List<AbstractChild> getChildren()
default <T extends Node> java.lang.Iterable<T> getChildren(java.lang.Class<T> childClass)
T - Type of searched children.childClass - The class of searched children.childClass.default <T extends Node> java.lang.Iterable<T> getChildren(java.lang.Class<T> childClass, java.util.function.Predicate<? super T> predicate)
T - Type of searched children.childClass - The class of searched children.predicate - The predicate.childClass and match predicate.default <T extends Node> T getChild(java.lang.Class<T> childClass, java.util.function.Predicate<? super T> predicate)
default <T extends Node> T getChild(java.lang.Class<T> childClass)
default <T extends Node> T getChildAt(java.lang.Class<T> childClass, java.util.function.Predicate<? super T> predicate, int index)
T - Type of searched children.childClass - The class of searched children.predicate - The predicate.index - The index of the searched child.
This index takes into account elements that match childClass and predicate.childClass and predicate and at index, or null.default <T extends Node> T getChildAt(java.lang.Class<T> childClass, int index)
T - Type of searched children.childClass - The class of searched children.index - The index of the searched child.
This index takes into account elements that match childClass.childClass and at index, or null.default java.lang.Iterable<Element> getElements()
default boolean hasElements()
true if this parent has children elements.default java.lang.Iterable<Element> getElementsNamed(java.lang.String name)
name - The name.name.default Element getElementNamedAt(java.lang.String name, int index)
name - The name.index - The index of the searched child element.
This index takes into account children that are elements and are named name.null.default Element getElementNamed(java.lang.String name)
null.name - The name.name or null.default java.lang.Iterable<Element> getElementsNamedIgnoreCase(java.lang.String name)
name - The name.name ignoring case.default Element getElementNamedIgnoreCaseAt(java.lang.String name, int index)
name - The name.index - The index of the searched child element.
This index takes into account children that are elements and are named name ignoring case.null.default Element getElementNamedIgnoreCase(java.lang.String name)
null.name - The name.name, ignoring case, or null.default Element getElementNamedWithAttribute(java.lang.String name, java.lang.String attributeName, java.lang.String attributeValue)
default java.lang.Iterable<Text> getTexts()
default boolean hasTexts()
true if this parent has texts children.default java.lang.Iterable<Comment> getComments()
default boolean hasComments()
true if this parent has comments children.default <T extends Node> int getChildrenCount(java.lang.Class<T> childClass, java.util.function.Predicate<? super T> predicate)
T - Type of counted children.childClass - The class of counted children.predicate - The predicate.childClass and predicate.default int getChildrenCount(java.lang.Class<? extends Node> childClass)
childClass - The class of counted children.childClass.default int getChildrenCount()
default <T extends Node> boolean hasChildren(java.lang.Class<T> childClass, java.util.function.Predicate<? super T> predicate)
true if this parent has children of a given class and matching a predicate.T - Type of searched children.childClass - The child class.predicate - The predicate.true if this parent has children of childClass class matching predicate.default boolean hasChildren(java.lang.Class<? extends Node> childClass)
true if this parent has children of a given class.childClass - The child class.true if this parent has children of childClass class.default boolean hasChildren()
true if this parent has children.default Child getChildAt(int index)
null is returned when index is invalid.
index - The index.index.java.lang.IndexOutOfBoundsException - When index is out of range (index < 0 || index >= getChildrenCount()).default Child getLastChild()
null.default <C extends Child> C addChild(C child)
If possible, child current parent is changed to this node.
C - Type of the child.child - The child. MUST NOT be null.child.java.lang.IllegalArgumentException - If child is null.java.lang.IllegalStateException - If child's parent can not be set.default Element addElement(java.lang.String name)
name - The child name.java.lang.IllegalStateException - If child's parent can not be set.default void addChildren(java.lang.Iterable<? extends Child> children)
children - The children.default void addChildren(Child... children)
children - The children.default boolean removeChild(Child child)
If child is not a child of this parent, then false is returned.
child - The child.true if child was removed, false otherwise.default Child removeChildAt(int index)
If index is invalid, returns false.
index - The index (0-based).java.lang.IndexOutOfBoundsException - When index is out of range (index < 0 || index >= getChildrenCount()).default void removeChildren()
default void removeChildren(java.util.function.Predicate<? super Child> predicate)
This does only a shallow removal.
For deep removal, use DataUtil.
predicate - The predicate.default void removeChildren(java.util.function.Predicate<? super Child> predicate, boolean recurse)
predicate - The predicate.recurse - If true, then this is applied recursively.default void removeElementsNamed(java.lang.String name)
name - The name of elements to remove.default void removeElementsNamed(java.lang.String name,
boolean recurse)
name - The name of elements to remove.recurse - If true, then this is applied recursively.default void removeComments()
default void removeComments(boolean recurse)
recurse - If true, then this is applied recursively.default void removeTexts()
default void removeTexts(boolean recurse)
recurse - If true, then this is applied recursively.default void removeIgnorableTexts()
default void removeIgnorableTexts(boolean recurse)
recurse - If true, then this is applied recursively.default void sortChildren(java.util.Comparator<? super Child> comparator)
comparator - The comparator.default void sortChildren(java.util.Comparator<? super Child> comparator, boolean recurse)
comparator - The comparator.recurse - If true, then this is applied recursively.default void mergeTexts()
default void mergeTexts(boolean recurse)
recurse - If true, then this is applied recursively.default void mergeComments()
default void mergeComments(boolean recurse)
recurse - If true, then this is applied recursively.default void changeTexts(java.util.function.Function<java.lang.String,java.lang.String> modifier)
modifier - A function that take content and returns new content.default void changeTexts(java.util.function.Function<java.lang.String,java.lang.String> modifier,
boolean recurse)
modifier - A function that take content and returns new content.recurse - If true, then this is applied recursively.default void changeNamedTexts(java.lang.String name,
java.util.function.Function<java.lang.String,java.lang.String> modifier)
This will work on elements that are empty or have text and comment children.
It will ignore elements that have children elements.
Children nodes are preserved if possible.
Otherwise, they are all removed and replace if necessary.
WARNING: This may remove comments.
name - The element name.modifier - A function that take content and returns new content.default void changeNamedTexts(java.lang.String name,
java.util.function.Function<java.lang.String,java.lang.String> modifier,
boolean recurse)
name - The element name.modifier - A function that take content and returns new content.recurse - If true, then this is applied recursively.default void changeComments(java.util.function.Function<java.lang.String,java.lang.String> modifier)
modifier - A function that take content and returns new content.default void changeComments(java.util.function.Function<java.lang.String,java.lang.String> modifier,
boolean recurse)
modifier - A function that take content and returns new content.recurse - If true, then this is applied recursively.Copyright © 2018. All rights reserved.