public interface AttributeMap extends java.lang.Iterable<AttributeInfo>
Modifier and Type | Method and Description |
---|---|
default AttributeMap |
apply(java.util.function.Function<AttributeInfo,AttributeInfo> mapper) |
default java.util.List<AttributeInfo> |
asList()
Get the contents of the AttributeMap as a list of
AttributeInfo objects. |
static AttributeMap |
fromList(java.util.List<AttributeInfo> list)
Construct an AttributeMap given a list of
AttributeInfo objects
representing the individual attributes. |
default AttributeInfo |
get(NodeName name)
Get the attribute with a given name, if it exists
|
default AttributeInfo |
get(java.lang.String uri,
java.lang.String local)
Get the attribute with a given name, if it exists
|
default AttributeInfo |
getByFingerprint(int fingerprint,
NamePool namePool) |
default java.lang.String |
getValue(java.lang.String uri,
java.lang.String local)
Get the value of the attribute with a given name, if it exists
|
default AttributeInfo |
itemAt(int index)
Get the AttributeInfo with a given index.
|
default AttributeMap |
put(AttributeInfo att)
Replace or add an attribute, to create a new AttributeMap
|
default AttributeMap |
remove(NodeName name)
Remove an existing attribute, to create a new AttributeMap
|
int |
size()
Return the number of attributes in the map.
|
default void |
verify() |
int size()
default AttributeInfo get(NodeName name)
name
- the name of the required attributedefault AttributeInfo get(java.lang.String uri, java.lang.String local)
uri
- the namespace part of the name of the required attributelocal
- the local part of the name of the required attributedefault AttributeInfo getByFingerprint(int fingerprint, NamePool namePool)
default java.lang.String getValue(java.lang.String uri, java.lang.String local)
uri
- the namespace URI part of the name of the required attributelocal
- the local part of the name of the required attributedefault AttributeMap put(AttributeInfo att)
att
- the attribute to be added or replaceddefault AttributeMap remove(NodeName name)
name
- the name of the attribute to be removed (if it exists)default void verify()
default AttributeMap apply(java.util.function.Function<AttributeInfo,AttributeInfo> mapper)
default java.util.List<AttributeInfo> asList()
AttributeInfo
objects.
The order of the returned list must be consistent with document order, with
the order of the attribute axis, and with position-based retrieval of individual
AttributeInfo
objects; multiple calls are not required to return the
same list, but they must be consistent in their ordering.
Modifying the returned list has no effect on the AttributeMap
default AttributeInfo itemAt(int index)
index
- the index position, zero-based. The order of index positions
of attributes in an attribute map reflects document order.asList().get(index)
. However, if the tree has been modified,
then the index values of the attributes may not be contiguous.java.lang.IndexOutOfBoundsException
- if the index is out of rangestatic AttributeMap fromList(java.util.List<AttributeInfo> list)
AttributeInfo
objects
representing the individual attributes.list
- the list of attributes. It is the caller's responsibility
to ensure that this list contains no duplicates. The method
may detect this, but is not guaranteed to do so. Calling
verify()
after constructing the attribute map verifies
that there are no duplicates. The order of items in the input
list is not necessarily preserved.java.lang.IllegalArgumentException
- if duplicate attributes are detectedCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.