public final class MicroElement extends AbstractMicroNodeWithChildren implements IMicroElement
IMicroElement interface.| Constructor and Description |
|---|
MicroElement(String sTagName) |
MicroElement(String sNamespaceURI,
String sTagName) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsAnyChildElement(Predicate<? super IMicroElement> aFilter)
Check if this element has at least one direct child element that matches
the provided filter.
|
IMicroElement |
findFirstChildElement(Predicate<? super IMicroElement> aFilter) |
void |
forAllAttributes(BiConsumer<? super IMicroQName,? super String> aConsumer)
Iterate all attribute objects.
|
void |
forAllAttributes(Consumer<? super IMicroAttribute> aConsumer)
Iterate all attribute objects.
|
void |
forAllAttributes(com.helger.commons.function.ITriConsumer<? super String,? super String,? super String> aConsumer)
Iterate all attribute objects.
|
void |
forAllChildElements(Predicate<? super IMicroElement> aFilter,
Consumer<? super IMicroElement> aConsumer) |
com.helger.commons.state.EContinue |
forAllChildElementsBreakable(Predicate<? super IMicroElement> aFilter,
Function<? super IMicroElement,com.helger.commons.state.EContinue> aConsumer) |
com.helger.commons.collection.ext.ICommonsList<? extends IMicroAttribute> |
getAllAttributeObjs()
Get a list of all attributes.
|
com.helger.commons.collection.ext.ICommonsOrderedSet<IMicroQName> |
getAllAttributeQNames()
Get a set of all attribute names.
|
com.helger.commons.collection.ext.ICommonsList<IMicroElement> |
getAllChildElementsRecursive()
Recursively get all child elements.
|
com.helger.commons.collection.ext.ICommonsOrderedMap<IMicroQName,String> |
getAllQAttributes()
Get a map of all fully qualified attribute names and values.
|
int |
getAttributeCount() |
MicroAttribute |
getAttributeObj(IMicroQName aQName)
Get the attribute object with the specified qualified name.
|
<DSTTYPE> DSTTYPE |
getAttributeValueWithConversion(IMicroQName aAttrName,
Class<DSTTYPE> aDstClass)
Get the attribute value of the given attribute name.
|
IMicroElement |
getClone() |
String |
getLocalName()
Get the local name of the element.
|
String |
getNamespaceURI()
Get the namespace URI of this element
|
String |
getNodeName() |
String |
getTagName()
Get the name of the tag.
|
EMicroNodeType |
getType() |
boolean |
hasAttribute(IMicroQName aAttrName)
Check if this element has an attribute with the specified name.
|
boolean |
hasAttributes() |
boolean |
hasNoAttributes() |
boolean |
isEqualContent(IMicroNode o)
As instances of this class may not implement equals/hashCode we need a way
to determine, if 2 nodes are equal by content.
|
com.helger.commons.state.EChange |
removeAllAttributes()
Remove all attributes from this element
|
com.helger.commons.state.EChange |
removeAttribute(IMicroQName aAttrName)
Remove the attribute with the given name.
|
MicroElement |
setAttribute(IMicroQName aAttrName,
String sAttrValue)
Set an attribute value of this element.
|
com.helger.commons.state.EChange |
setNamespaceURI(String sNamespaceURI)
Set a new namespace URI for this element.
|
String |
toString() |
containsAnyChild, directGetAllChildren, findFirstChild, findFirstChildMapped, forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getAllChildren, getChildAtIndex, getChildCount, getFirstChild, getLastChild, getTextContent, getTextContentWithConversion, hasChildren, onAppendChild, onInsertAfter, onInsertAtIndex, onInsertBefore, onRemoveAllChildren, onRemoveChild, onRemoveChildAtIndexappendCDATA, appendCDATA, appendCDATAWithConversion, appendChild, appendComment, appendComment, appendCommentWithConversion, appendContainer, appendElement, appendElement, appendEntityReference, appendIgnorableWhitespaceText, appendIgnorableWhitespaceText, appendProcessingInstruction, appendText, appendText, appendTextWithConversion, detachFromParent, getAllEventTargets, getAllEventTargets, getNextSibling, getParent, getParentElementWithName, getParentElementWithName, getPreviousSibling, hasParent, insertAfter, insertAtIndex, insertBefore, internalResetParentNode, internalSetParentNode, internalTriggerEvent, isCDATA, isComment, isContainer, isDocument, isDocumentType, isElement, isEntityReference, isProcessingInstruction, isText, onEvent, registerEventTarget, removeAllChildren, removeChild, removeChildAtIndex, replaceChild, unregisterEventTargetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfilterName, filterNamespaceURI, filterNamespaceURIAndName, forAllChildElements, forAllChildElementsBreakable, getAllChildElements, getAllChildElements, getAllChildElements, getAllChildElements, getAttributeObj, getAttributeObj, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValueAsBool, getAttributeValueAsBool, getAttributeValueAsBool, getAttributeValueAsDouble, getAttributeValueAsDouble, getAttributeValueAsDouble, getAttributeValueAsFloat, getAttributeValueAsFloat, getAttributeValueAsFloat, getAttributeValueAsInt, getAttributeValueAsInt, getAttributeValueAsInt, getAttributeValueAsLong, getAttributeValueAsLong, getAttributeValueAsLong, getAttributeValueWithConversion, getAttributeValueWithConversion, getChildElementCount, getChildElementCount, getFirstChildElement, getFirstChildElement, getFirstChildElement, hasAttribute, hasAttribute, hasChildElements, hasChildElements, hasChildElements, hasLocalName, hasNamespaceURI, hasNamespaceURI, hasNoNamespaceURI, hasTagName, hasTagNameIgnoreCase, removeAttribute, removeAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeWithConversion, setAttributeWithConversion, setAttributeWithConversiongetTextContent, getTextContentTrimmed, getTextContentWithConversionappendCDATA, appendCDATA, appendCDATA, appendCDATAWithConversion, appendChild, appendComment, appendComment, appendComment, appendCommentWithConversion, appendContainer, appendElement, appendElement, appendEntityReference, appendIgnorableWhitespaceText, appendIgnorableWhitespaceText, appendIgnorableWhitespaceText, appendProcessingInstruction, appendText, appendText, appendText, appendTextWithConversion, containsAnyChild, detachFromParent, getAllChildren, getAllChildrenRecursive, getAllEventTargets, getAllEventTargets, getFirstChild, getLastChild, getNextSibling, getNodeValue, getParent, getParentElementWithName, getParentElementWithName, getPreviousSibling, hasParent, insertAfter, insertAtIndex, insertBefore, isCDATA, isComment, isContainer, isDocument, isDocumentType, isElement, isEntityReference, isProcessingInstruction, isText, registerEventTarget, removeAllChildren, removeChild, removeChildAtIndex, replaceChild, unregisterEventTargetfindFirstChild, findFirstChildMapped, getChildAtIndex@Nonnull public EMicroNodeType getType()
getType in interface IMicroNodenull.@Nonnull @Nonempty public String getNodeName()
getNodeName in interface IMicroNodeIMicroElement nodes this is the same as the tag name.public boolean hasAttributes()
hasAttributes in interface IMicroElementtrue if this element has at least one attribute,
false otherwisepublic boolean hasNoAttributes()
hasNoAttributes in interface IMicroElementtrue if this element has no attribute,
false if at least one attribute is present.@Nonnegative public int getAttributeCount()
getAttributeCount in interface IMicroElement@Nullable @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsList<? extends IMicroAttribute> getAllAttributeObjs()
IMicroElementnull if
IMicroElement.hasAttributes() returns true.getAllAttributeObjs in interface IMicroElementnull.@Nullable @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsOrderedMap<IMicroQName,String> getAllQAttributes()
IMicroElementnull if IMicroElement.hasAttributes() returns
true.getAllQAttributes in interface IMicroElementnull.@Nullable @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsOrderedSet<IMicroQName> getAllAttributeQNames()
IMicroElementnull if
IMicroElement.hasAttributes() returns true.getAllAttributeQNames in interface IMicroElementnull.public void forAllAttributes(@Nonnull Consumer<? super IMicroAttribute> aConsumer)
IMicroElementforAllAttributes in interface IMicroElementaConsumer - The consumer. May not be null. May only perform reading
operations!public void forAllAttributes(@Nonnull BiConsumer<? super IMicroQName,? super String> aConsumer)
IMicroElementforAllAttributes in interface IMicroElementaConsumer - The consumer that takes the QName and the value. May not be
null. May only perform reading operations!public void forAllAttributes(@Nonnull com.helger.commons.function.ITriConsumer<? super String,? super String,? super String> aConsumer)
IMicroElementforAllAttributes in interface IMicroElementaConsumer - The consumer that takes the namespace URI, the attribute local name
and the attribute value. May not be null. May only
perform reading operations!@Nullable public MicroAttribute getAttributeObj(@Nullable IMicroQName aQName)
IMicroElementgetAttributeObj in interface IMicroElementaQName - The qualified attribute name to check. May be null.null of no such attribute object exists.@Nullable public <DSTTYPE> DSTTYPE getAttributeValueWithConversion(@Nullable IMicroQName aAttrName, @Nonnull Class<DSTTYPE> aDstClass)
IMicroElementnull is returned. The attribute value is
converted via the TypeConverter to
the desired destination class. If no such attribute is present,
null is returned.getAttributeValueWithConversion in interface IMicroElementDSTTYPE - Destination typeaAttrName - The attribute qualified name to retrieve the value of.aDstClass - The destination class.null.public boolean hasAttribute(@Nullable IMicroQName aAttrName)
IMicroElementhasAttribute in interface IMicroElementaAttrName - The qualified attribute name to check. May be null.true if such an attribute is present,
false otherwise@Nonnull public com.helger.commons.state.EChange removeAttribute(@Nullable IMicroQName aAttrName)
IMicroElementremoveAttribute in interface IMicroElementaAttrName - The qualified name of the attribute to be removed. May be
null.EChange.CHANGED if the attribute was removed,
EChange.UNCHANGED if no such attribute exists at this
element.@Nonnull public MicroElement setAttribute(@Nonnull IMicroQName aAttrName, @Nullable String sAttrValue)
IMicroElementsetAttribute in interface IMicroElementaAttrName - Qualified name of the attribute. May neither be null
nor empty.sAttrValue - If the value is null the attribute is removed (if
present)@Nonnull public com.helger.commons.state.EChange removeAllAttributes()
IMicroElementremoveAllAttributes in interface IMicroElementEChange.@Nullable public String getNamespaceURI()
IMicroElementgetNamespaceURI in interface IMicroElementnull if this element has no namespace URI.@Nonnull public com.helger.commons.state.EChange setNamespaceURI(@Nullable String sNamespaceURI)
IMicroElementsetNamespaceURI in interface IMicroElementsNamespaceURI - The namespace URI to be set. May be null or empty to
indicate that the namespace should be removed.EChange@Nullable public String getLocalName()
IMicroElementIMicroElement.getTagName() but it is only present, if a namespace URI is
present.getLocalName in interface IMicroElementnull if no namespace is present.@Nonnull public String getTagName()
IMicroElementIMicroElement.getLocalName() if a namespace URI is present.getTagName in interface IMicroElementnull.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.ext.ICommonsList<IMicroElement> getAllChildElementsRecursive()
IMicroElementgetAllChildElementsRecursive in interface IMicroElementnull but empty.public boolean containsAnyChildElement(@Nullable Predicate<? super IMicroElement> aFilter)
IMicroElementcontainsAnyChildElement in interface IMicroElementaFilter - The filter to be applied. May be null.true if this element has at least one direct child
element that matches the passed filter, false
otherwise.@Nullable public IMicroElement findFirstChildElement(@Nullable Predicate<? super IMicroElement> aFilter)
findFirstChildElement in interface IMicroElementpublic void forAllChildElements(@Nonnull Predicate<? super IMicroElement> aFilter, @Nonnull Consumer<? super IMicroElement> aConsumer)
forAllChildElements in interface IMicroElement@Nonnull public com.helger.commons.state.EContinue forAllChildElementsBreakable(@Nonnull Predicate<? super IMicroElement> aFilter, @Nonnull Function<? super IMicroElement,com.helger.commons.state.EContinue> aConsumer)
forAllChildElementsBreakable in interface IMicroElement@Nonnull public IMicroElement getClone()
IMicroElementgetClone in interface com.helger.commons.lang.ICloneable<IMicroNode>getClone in interface IMicroElementgetClone in interface IMicroNodeWithChildrenpublic boolean isEqualContent(@Nullable IMicroNode o)
IMicroNodeisEqualContent in interface IMicroNodeisEqualContent in class AbstractMicroNodeWithChildreno - The node to compare to this.true if the nodes are of the same type and the same
content, false otherwise.public String toString()
toString in class AbstractMicroNodeWithChildrenCopyright © 2014–2016 Philip Helger. All rights reserved.