public abstract class AbstractMicroNode extends Object implements IMicroNode
| Constructor and Description |
|---|
AbstractMicroNode() |
| Modifier and Type | Method and Description |
|---|---|
IMicroCDATA |
appendCDATA(char[] aChars,
int nOfs,
int nLen)
Append a CDATA node to this node.
|
IMicroCDATA |
appendCDATA(CharSequence sText)
Append a CDATA node to this node.
|
IMicroCDATA |
appendCDATAWithConversion(Object aValue)
Append a CDATA node to this node.
|
<NODETYPE extends IMicroNode> |
appendChild(NODETYPE aChildNode)
Append any child to the node.
|
IMicroComment |
appendComment(char[] aChars,
int nOfs,
int nLen)
Append a comment node to this node.
|
IMicroComment |
appendComment(CharSequence sText)
Append a comment node to this node.
|
IMicroComment |
appendCommentWithConversion(Object aValue)
Append a comment node to this node.
|
IMicroContainer |
appendContainer()
Append a new container to this node
|
IMicroElement |
appendElement(String sTagName)
Append an element without namespace to this node.
|
IMicroElement |
appendElement(String sNamespaceURI,
String sTagName)
Append an element with namespace to this node.
|
IMicroEntityReference |
appendEntityReference(String sName)
Append an entity reference to this node.
|
IMicroText |
appendIgnorableWhitespaceText(char[] aChars,
int nOfs,
int nLen)
Append a text node which is ignorable whitespace content to this node.
|
IMicroText |
appendIgnorableWhitespaceText(CharSequence sText)
Append a text node which is ignorable whitespace content to this node.
|
IMicroProcessingInstruction |
appendProcessingInstruction(String sTarget,
String sData)
Append a processing instruction to this node.
|
IMicroText |
appendText(char[] aChars,
int nOfs,
int nLen)
Append a text node to this node.
|
IMicroText |
appendText(CharSequence sText)
Append a text node to this node.
|
IMicroText |
appendTextWithConversion(Object aValue)
Append a text node to this node.
|
IMicroNode |
detachFromParent()
Detach this node from the parent node so it can be inserted into another
node without problems.
|
IMicroNode |
findFirstChild(Predicate<? super IMicroNode> aFilter) |
<DSTTYPE> DSTTYPE |
findFirstChildMapped(Predicate<? super IMicroNode> aFilter,
Function<? super IMicroNode,? extends DSTTYPE> aMapper) |
void |
forAllChildren(Consumer<? super IMicroNode> aConsumer) |
void |
forAllChildren(Predicate<? super IMicroNode> aFilter,
Consumer<? super IMicroNode> aConsumer) |
com.helger.commons.state.EContinue |
forAllChildrenBreakable(com.helger.commons.function.IBreakableConsumer<? super IMicroNode> aConsumer) |
<DSTTYPE> void |
forAllChildrenMapped(Predicate<? super IMicroNode> aFilter,
Function<? super IMicroNode,? extends DSTTYPE> aMapper,
Consumer<? super DSTTYPE> aConsumer) |
com.helger.commons.collection.ext.ICommonsList<IMicroNode> |
getAllChildren()
Get a list of all direct child nodes.
|
com.helger.commons.collection.ext.ICommonsMap<EMicroEvent,com.helger.commons.collection.ext.ICommonsSet<IMicroEventTarget>> |
getAllEventTargets() |
com.helger.commons.collection.ext.ICommonsSet<IMicroEventTarget> |
getAllEventTargets(EMicroEvent eEvent)
Get all event targets for a certain event.
|
IMicroNode |
getChildAtIndex(int nIndex) |
int |
getChildCount() |
IMicroNode |
getFirstChild() |
IMicroNode |
getLastChild() |
IMicroNode |
getNextSibling() |
IMicroNode |
getParent() |
IMicroElement |
getParentElementWithName(String sTagName) |
IMicroElement |
getParentElementWithName(String sNamespaceURI,
String sTagName) |
IMicroNode |
getPreviousSibling() |
boolean |
hasChildren() |
boolean |
hasParent() |
<NODETYPE extends IMicroNode> |
insertAfter(NODETYPE aChildNode,
IMicroNode aPredecessor)
Insert an existing node after a certain child node of this.
|
<NODETYPE extends IMicroNode> |
insertAtIndex(int nIndex,
NODETYPE aChildNode)
Insert an existing node as a child at the specified index.
|
<NODETYPE extends IMicroNode> |
insertBefore(NODETYPE aChildNode,
IMicroNode aSuccessor)
Insert an existing node before a certain child node of this.
|
boolean |
isCDATA() |
boolean |
isComment() |
boolean |
isContainer() |
boolean |
isDocument() |
boolean |
isDocumentType() |
boolean |
isElement() |
boolean |
isEntityReference() |
boolean |
isProcessingInstruction() |
boolean |
isText() |
protected void |
onAppendChild(AbstractMicroNode aChildNode)
Callback that is invoked once a child is to be appended.
|
protected void |
onEvent(EMicroEvent eEventType,
IMicroNode aSourceNode,
IMicroNode aTargetNode) |
protected void |
onInsertAfter(AbstractMicroNode aChildNode,
IMicroNode aPredecessor)
Callback that is invoked once a child is to be inserted after another
child.
|
protected void |
onInsertAtIndex(int nIndex,
AbstractMicroNode aChildNode)
Callback that is invoked once a child is to be inserted at the specified
index.
|
protected void |
onInsertBefore(AbstractMicroNode aChildNode,
IMicroNode aSuccessor)
Callback that is invoked once a child is to be inserted before another
child.
|
protected com.helger.commons.state.EChange |
onRemoveAllChildren()
Remove all children from this node.
|
protected com.helger.commons.state.EChange |
onRemoveChild(IMicroNode aChild)
Callback when a child is removed.
|
protected com.helger.commons.state.EChange |
onRemoveChildAtIndex(int nIndex)
Remove the child not at the specified index.
|
com.helger.commons.state.EChange |
registerEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Register a specific MicroDOM event listener.
|
com.helger.commons.state.EChange |
removeAllChildren()
Remove all children from this node.
|
com.helger.commons.state.EChange |
removeChild(IMicroNode aChild)
Remove the passed child.
|
com.helger.commons.state.EChange |
removeChildAtIndex(int nIndex)
Remove the child not at the specified index.
|
com.helger.commons.state.EChange |
replaceChild(IMicroNode aOldChild,
IMicroNode aNewChild)
Replace the passed old child with the new child.
|
String |
toString() |
com.helger.commons.state.EChange |
unregisterEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Unregister a specific MicroDOM event listener.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitappendCDATA, appendComment, appendIgnorableWhitespaceText, appendText, containsAnyChild, getAllChildrenRecursive, getNodeName, getNodeValue, getType, isEqualContent@OverrideOnDemand protected void onAppendChild(@Nonnull AbstractMicroNode aChildNode)
aChildNode - The appended child node.@OverrideOnDemand protected void onInsertBefore(@Nonnull AbstractMicroNode aChildNode, @Nonnull IMicroNode aSuccessor)
aChildNode - The new child node to be inserted.aSuccessor - The node before which the new node will be inserted.@OverrideOnDemand protected void onInsertAfter(@Nonnull AbstractMicroNode aChildNode, @Nonnull IMicroNode aPredecessor)
aChildNode - The new child node to be inserted.aPredecessor - The node after which the new node will be inserted.@OverrideOnDemand protected void onInsertAtIndex(@Nonnegative int nIndex, @Nonnull AbstractMicroNode aChildNode)
nIndex - The index where the node should be inserted.aChildNode - The new child node to be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE appendChild(@Nullable NODETYPE aChildNode)
IMicroNodeappendChild in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The child node to append. May be null.null if the parameter was
null.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertBefore(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aSuccessor)
IMicroNodeinsertBefore in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aSuccessor - The node before which the new node will be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertAfter(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aPredecessor)
IMicroNodeinsertAfter in interface IMicroNodeNODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aPredecessor - The node after which the new node will be inserted.@Nullable public final <NODETYPE extends IMicroNode> NODETYPE insertAtIndex(@Nonnegative int nIndex, @Nullable NODETYPE aChildNode)
IMicroNodeinsertAtIndex in interface IMicroNodeNODETYPE - Parameter type == return typenIndex - The index to insert. Must be ≥ 0.aChildNode - The new child node to be inserted.@Nonnull public final IMicroText appendText(@Nullable CharSequence sText)
IMicroNodeappendText in interface IMicroNodesText - text to be added@Nonnull public final IMicroText appendText(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendText in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroText appendTextWithConversion(@Nullable Object aValue)
IMicroNodeString, the TypeConverter is
invoked to convert it to a String object.appendTextWithConversion in interface IMicroNodeaValue - text to be added@Nonnull public final IMicroText appendIgnorableWhitespaceText(@Nullable CharSequence sText)
IMicroNodeappendIgnorableWhitespaceText in interface IMicroNodesText - The whitespace content to be added.@Nonnull public final IMicroText appendIgnorableWhitespaceText(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendIgnorableWhitespaceText in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroCDATA appendCDATA(@Nullable CharSequence sText)
IMicroNodeappendCDATA in interface IMicroNodesText - CDATA text@Nonnull public final IMicroCDATA appendCDATA(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendCDATA in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroCDATA appendCDATAWithConversion(@Nullable Object aValue)
IMicroNodeString, the TypeConverter is
invoked to convert it to a String object.appendCDATAWithConversion in interface IMicroNodeaValue - CDATA to be added@Nonnull public final IMicroComment appendComment(@Nullable CharSequence sText)
IMicroNodeappendComment in interface IMicroNodesText - comment text@Nonnull public final IMicroComment appendComment(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
IMicroNodeappendComment in interface IMicroNodeaChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.@Nonnull public final IMicroComment appendCommentWithConversion(@Nullable Object aValue)
IMicroNodeString, the TypeConverter is
invoked to convert it to a String object.appendCommentWithConversion in interface IMicroNodeaValue - Comment to be added@Nonnull public final IMicroEntityReference appendEntityReference(@Nonnull @Nonempty String sName)
IMicroNodeappendEntityReference in interface IMicroNodesName - The name of the entity reference.@Nonnull public final IMicroElement appendElement(@Nonnull @Nonempty String sTagName)
IMicroNodeappendElement in interface IMicroNodesTagName - Element name to be created. May neither be null nor
empty.@Nonnull public final IMicroElement appendElement(@Nullable String sNamespaceURI, @Nonnull @Nonempty String sTagName)
IMicroNodeappendElement in interface IMicroNodesNamespaceURI - Namespace URI to use. May be null.sTagName - Element name to be created. May neither be null nor
empty.@Nonnull public final IMicroProcessingInstruction appendProcessingInstruction(@Nonnull @Nonempty String sTarget, @Nullable String sData)
IMicroNodeappendProcessingInstruction in interface IMicroNodesTarget - The PI targetsData - The PI data@Nonnull public final IMicroContainer appendContainer()
IMicroNodeappendContainer in interface IMicroNode@OverrideOnDemand @Nonnull protected com.helger.commons.state.EChange onRemoveChild(IMicroNode aChild)
aChild - The child that is removed.EChange.CHANGED if something changed@Nonnull public final com.helger.commons.state.EChange removeChild(@Nonnull IMicroNode aChild)
IMicroNoderemoveChild in interface IMicroNodeaChild - The child to be removed. May not be null.EChange.CHANGED if the child was successfully removed,
EChange.UNCHANGED otherwise.@OverrideOnDemand @Nonnull protected com.helger.commons.state.EChange onRemoveChildAtIndex(int nIndex)
nIndex - The 0-based index of the item to be removed.EChange.CHANGED if the node was successfully removed,
EChange.UNCHANGED otherwise.@Nonnull public final com.helger.commons.state.EChange removeChildAtIndex(@Nonnegative int nIndex)
IMicroNoderemoveChildAtIndex in interface IMicroNodenIndex - The 0-based index of the item to be removed.EChange.CHANGED if the node was successfully removed,
EChange.UNCHANGED otherwise.@OverrideOnDemand @Nonnull protected com.helger.commons.state.EChange onRemoveAllChildren()
EChange.CHANGED if at least one child was present, and was
successfully removed, EChange.UNCHANGED otherwise.@Nonnull public final com.helger.commons.state.EChange removeAllChildren()
IMicroNoderemoveAllChildren in interface IMicroNodeEChange.CHANGED if at least one child was present, and was
successfully removed, EChange.UNCHANGED otherwise.@Nonnull public final com.helger.commons.state.EChange replaceChild(@Nonnull IMicroNode aOldChild, @Nonnull IMicroNode aNewChild)
IMicroNodereplaceChild in interface IMicroNodeaOldChild - The child to be removed. May not be null.aNewChild - The child to be inserted instead. May not be null.EChange.CHANGED if the child was successfully replaced,
EChange.UNCHANGED if old child and new child are identical.@OverrideOnDemand public boolean hasChildren()
hasChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@OverrideOnDemand @Nullable public com.helger.commons.collection.ext.ICommonsList<IMicroNode> getAllChildren()
IMicroNodegetAllChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>getAllChildren in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>getAllChildren in interface IMicroNodenull if the node has no children.public void forAllChildren(@Nonnull Consumer<? super IMicroNode> aConsumer)
forAllChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@Nonnull public com.helger.commons.state.EContinue forAllChildrenBreakable(@Nonnull com.helger.commons.function.IBreakableConsumer<? super IMicroNode> aConsumer)
forAllChildrenBreakable in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>public void forAllChildren(@Nonnull Predicate<? super IMicroNode> aFilter, @Nonnull Consumer<? super IMicroNode> aConsumer)
forAllChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>public <DSTTYPE> void forAllChildrenMapped(@Nonnull Predicate<? super IMicroNode> aFilter, @Nonnull Function<? super IMicroNode,? extends DSTTYPE> aMapper, @Nonnull Consumer<? super DSTTYPE> aConsumer)
forAllChildrenMapped in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@OverrideOnDemand @Nullable public IMicroNode getChildAtIndex(@Nonnegative int nIndex)
getChildAtIndex in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>@OverrideOnDemand @Nonnegative public int getChildCount()
getChildCount in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>@OverrideOnDemand @Nullable public IMicroNode getFirstChild()
getFirstChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>getFirstChild in interface IMicroNodenull if this
node has no children.@Nullable public IMicroNode findFirstChild(@Nonnull Predicate<? super IMicroNode> aFilter)
findFirstChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>@Nullable public <DSTTYPE> DSTTYPE findFirstChildMapped(@Nonnull Predicate<? super IMicroNode> aFilter, @Nonnull Function<? super IMicroNode,? extends DSTTYPE> aMapper)
findFirstChildMapped in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>@OverrideOnDemand @Nullable public IMicroNode getLastChild()
getLastChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>getLastChild in interface IMicroNodenull if this node
has no children.@Nullable public final IMicroNode getPreviousSibling()
getPreviousSibling in interface IMicroNodenull if this node has no preceding siblings.@Nullable public final IMicroNode getNextSibling()
getNextSibling in interface IMicroNodenull
if this node has no succeeding siblings.public final boolean hasParent()
hasParent in interface IMicroNodetrue if this node has a parent node assigned,
false otherwise.@Nullable public final IMicroNode getParent()
getParent in interface com.helger.commons.hierarchy.IHasParent<IMicroNode>getParent in interface IMicroNodenull.@Nonnull public final IMicroNode detachFromParent()
IMicroNodeIllegalStateException if adding this node again to another parent
since each node can only have one parent.detachFromParent in interface IMicroNode@Nullable public final IMicroElement getParentElementWithName(@Nullable String sTagName)
getParentElementWithName in interface IMicroNode@Nullable public final IMicroElement getParentElementWithName(@Nullable String sNamespaceURI, @Nullable String sTagName)
getParentElementWithName in interface IMicroNodepublic final boolean isDocument()
isDocument in interface IMicroNodetrue if this node can safely be casted to
IMicroDocument.public final boolean isDocumentType()
isDocumentType in interface IMicroNodetrue if this node can safely be casted to
IMicroDocumentType.public final boolean isText()
isText in interface IMicroNodetrue if this node can safely be casted to
IMicroText.public final boolean isCDATA()
isCDATA in interface IMicroNodetrue if this node can safely be casted to
IMicroCDATA.public final boolean isComment()
isComment in interface IMicroNodetrue if this node can safely be casted to
IMicroComment.public final boolean isEntityReference()
isEntityReference in interface IMicroNodetrue if this node can safely be casted to
IMicroEntityReference.public final boolean isElement()
isElement in interface IMicroNodetrue if this node can safely be casted to
IMicroElement.public final boolean isProcessingInstruction()
isProcessingInstruction in interface IMicroNodetrue if this node can safely be casted to
IMicroProcessingInstruction.public final boolean isContainer()
isContainer in interface IMicroNodetrue if this node can safely be casted to
IMicroContainer.protected final void onEvent(@Nonnull EMicroEvent eEventType, @Nonnull IMicroNode aSourceNode, @Nonnull IMicroNode aTargetNode)
@Nonnull public com.helger.commons.state.EChange registerEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
IMicroNoderegisterEventTarget in interface IMicroNodeeEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was registered,
EChange.UNCHANGED otherwise.@Nonnull public com.helger.commons.state.EChange unregisterEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
IMicroNodeunregisterEventTarget in interface IMicroNodeeEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was unregistered,
EChange.UNCHANGED otherwise.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsMap<EMicroEvent,com.helger.commons.collection.ext.ICommonsSet<IMicroEventTarget>> getAllEventTargets()
getAllEventTargets in interface IMicroNodenull.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsSet<IMicroEventTarget> getAllEventTargets(@Nullable EMicroEvent eEvent)
IMicroNodegetAllEventTargets in interface IMicroNodeeEvent - The event to be queried. May be null.null.Copyright © 2014–2016 Philip Helger. All rights reserved.