public class XmlElement extends OrphanXmlElement
Element which is mergeable.
A mergeable element can contains 3 types of children :
XmlNode.Name, XmlNode.NamespaceAwareName, XmlNode.NodeKey, XmlNode.NodeNameNODE_TO_NAME| Constructor and Description |
|---|
XmlElement(org.w3c.dom.Element xml,
XmlDocument document) |
| Modifier and Type | Method and Description |
|---|---|
com.google.common.base.Optional<java.lang.String> |
compareTo(java.lang.Object other)
Compares this element with another
XmlElement ignoring all attributes belonging to
the SdkConstants.TOOLS_URI namespace. |
com.google.common.collect.ImmutableList<XmlElement> |
getAllNodesByType(com.android.manifmerger.ManifestModel.NodeTypes type)
Returns all immediate children of this node for a particular type, irrespective of their
key.
|
com.google.common.base.Optional<XmlAttribute> |
getAttribute(XmlNode.NodeName attributeName)
Returns the
XmlAttribute for an attribute present on this
xml element, or Optional.absent() if not present. |
java.util.Collection<java.util.Map.Entry<XmlNode.NodeName,com.android.manifmerger.AttributeOperationType>> |
getAttributeOperations() |
com.android.manifmerger.AttributeOperationType |
getAttributeOperationType(XmlNode.NodeName attributeName)
Get the attribute operation type as optionally specified by the user.
|
java.util.List<XmlAttribute> |
getAttributes()
Returns the list of attributes for this xml element.
|
XmlDocument |
getDocument()
Returns the owning
XmlDocument |
com.google.common.collect.ImmutableList<XmlElement> |
getMergeableElements() |
com.google.common.base.Optional<XmlElement> |
getNodeByTypeAndKey(com.android.manifmerger.ManifestModel.NodeTypes type,
java.lang.String keyValue)
Returns a child of a particular type and a particular key.
|
NodeOperationType |
getOperationType()
Get the node operation type as optionally specified by the user.
|
java.util.List<Selector> |
getOverrideUsesSdkLibrarySelectors() |
com.android.ide.common.blame.SourcePosition |
getPosition()
Returns the element's position
|
Selector |
getSelector()
Returns a potentially null (if not present) selector decoration on this element.
|
com.android.ide.common.blame.SourceFile |
getSourceFile()
Returns the element's document xml source file location.
|
boolean |
isEquals(XmlElement otherNode) |
void |
mergeChildren(XmlElement lowerPriorityNode,
com.android.manifmerger.MergingReport.Builder mergingReport) |
void |
mergeWithLowerPriorityNode(XmlElement lowerPriorityNode,
com.android.manifmerger.MergingReport.Builder mergingReport)
Merge this xml element with a lower priority node.
|
boolean |
supportsSelector()
Returns true if this element supports having a tools:selector decoration, false otherwise.
|
getId, getKey, getName, getType, getXml, isAfromNSName, fromXmlName, getOriginalId, getSourceFilePosition, printPosition, unwrapNamepublic XmlElement(@NonNull
org.w3c.dom.Element xml,
@NonNull
XmlDocument document)
@NonNull public XmlDocument getDocument()
XmlDocumentpublic java.util.List<XmlAttribute> getAttributes()
public com.google.common.base.Optional<XmlAttribute> getAttribute(XmlNode.NodeName attributeName)
XmlAttribute for an attribute present on this
xml element, or Optional.absent() if not present.attributeName - the attribute name.@NonNull public NodeOperationType getOperationType()
NodeOperationType.MERGE will be returned.@NonNull public com.android.manifmerger.AttributeOperationType getAttributeOperationType(XmlNode.NodeName attributeName)
AttributeOperationType.STRICT will be returned.@NonNull public java.util.Collection<java.util.Map.Entry<XmlNode.NodeName,com.android.manifmerger.AttributeOperationType>> getAttributeOperations()
@NonNull public java.util.List<Selector> getOverrideUsesSdkLibrarySelectors()
@NonNull public com.android.ide.common.blame.SourcePosition getPosition()
XmlNodegetPosition in class OrphanXmlElement@NonNull public com.android.ide.common.blame.SourceFile getSourceFile()
XmlNodegetSourceFile in class OrphanXmlElementpublic void mergeWithLowerPriorityNode(@NonNull
XmlElement lowerPriorityNode,
@NonNull
com.android.manifmerger.MergingReport.Builder mergingReport)
lowerPriorityNode - lower priority Xml element to merge with.mergingReport - the merging report to log errors and actions.@NonNull public com.google.common.collect.ImmutableList<XmlElement> getMergeableElements()
@NonNull public com.google.common.base.Optional<XmlElement> getNodeByTypeAndKey(com.android.manifmerger.ManifestModel.NodeTypes type, @Nullable java.lang.String keyValue)
type - the requested child type.keyValue - the requested child key.Optional.absent() if no child of this
type and key exist.@NonNull public com.google.common.collect.ImmutableList<XmlElement> getAllNodesByType(com.android.manifmerger.ManifestModel.NodeTypes type)
type - the type of children element requested.public void mergeChildren(@NonNull
XmlElement lowerPriorityNode,
@NonNull
com.android.manifmerger.MergingReport.Builder mergingReport)
public boolean supportsSelector()
public boolean isEquals(XmlElement otherNode)
@Nullable public Selector getSelector()
@NonNull public com.google.common.base.Optional<java.lang.String> compareTo(java.lang.Object other)
XmlElement ignoring all attributes belonging to
the SdkConstants.TOOLS_URI namespace.other - the other element to compare against.String describing the differences between the two XML elements or
Optional.absent() if they are equals.