Package net.sf.saxon.om
Class SingletonAttributeMap
- java.lang.Object
-
- net.sf.saxon.om.AttributeInfo
-
- net.sf.saxon.om.SingletonAttributeMap
-
- All Implemented Interfaces:
java.lang.Iterable<AttributeInfo>,AttributeMap
public class SingletonAttributeMap extends AttributeInfo implements AttributeMap
An implementation of AttributeMap for use when there is exactly one attribute
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.saxon.om.AttributeInfo
AttributeInfo.Deleted
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeMapapply(java.util.function.Function<AttributeInfo,AttributeInfo> mapper)java.util.List<AttributeInfo>asList()Get the contents of the AttributeMap as a list ofAttributeInfoobjects.AttributeInfoget(java.lang.String uri, java.lang.String local)Get the attribute with a given name, if it existsAttributeInfoget(NodeName name)Get the attribute with a given name, if it existsAttributeInfogetByFingerprint(int fingerprint, NamePool namePool)AttributeInfoitemAt(int index)Get the AttributeInfo with a given index.java.util.Iterator<AttributeInfo>iterator()static SingletonAttributeMapof(AttributeInfo att)AttributeMapput(AttributeInfo att)Replace or add an attribute, to create a new AttributeMapAttributeMapremove(NodeName name)Remove an existing attribute, to create a new AttributeMapintsize()Return the number of attributes in the map.-
Methods inherited from class net.sf.saxon.om.AttributeInfo
getLocation, getNodeName, getProperties, getType, getValue, isId, withNodeName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.AttributeMap
getValue, verify
-
-
-
-
Method Detail
-
of
public static SingletonAttributeMap of(AttributeInfo att)
-
size
public int size()
Return the number of attributes in the map.- Specified by:
sizein interfaceAttributeMap- Returns:
- The number of attributes in the map.
-
get
public AttributeInfo get(NodeName name)
Description copied from interface:AttributeMapGet the attribute with a given name, if it exists- Specified by:
getin interfaceAttributeMap- Parameters:
name- the name of the required attribute- Returns:
- the required attribute if it exists
-
get
public AttributeInfo get(java.lang.String uri, java.lang.String local)
Description copied from interface:AttributeMapGet the attribute with a given name, if it exists- Specified by:
getin interfaceAttributeMap- Parameters:
uri- the namespace part of the name of the required attributelocal- the local part of the name of the required attribute- Returns:
- the required attribute if it exists
-
getByFingerprint
public AttributeInfo getByFingerprint(int fingerprint, NamePool namePool)
- Specified by:
getByFingerprintin interfaceAttributeMap
-
put
public AttributeMap put(AttributeInfo att)
Description copied from interface:AttributeMapReplace or add an attribute, to create a new AttributeMap- Specified by:
putin interfaceAttributeMap- Parameters:
att- the attribute to be added or replaced- Returns:
- the new AttributeMap
-
remove
public AttributeMap remove(NodeName name)
Description copied from interface:AttributeMapRemove an existing attribute, to create a new AttributeMap- Specified by:
removein interfaceAttributeMap- Parameters:
name- the name of the attribute to be removed (if it exists)- Returns:
- a new attribute map in which the specified attribute is omitted. If the attribute map contains no attribute with the given name, the input attribute map (or one equivalent to it) is returned unchanged
-
iterator
public java.util.Iterator<AttributeInfo> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<AttributeInfo>
-
apply
public AttributeMap apply(java.util.function.Function<AttributeInfo,AttributeInfo> mapper)
- Specified by:
applyin interfaceAttributeMap
-
asList
public java.util.List<AttributeInfo> asList()
Description copied from interface:AttributeMapGet the contents of the AttributeMap as a list ofAttributeInfoobjects.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
AttributeInfoobjects; 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
- Specified by:
asListin interfaceAttributeMap- Returns:
- a list of attributes in the AttributeMap
-
itemAt
public AttributeInfo itemAt(int index)
Description copied from interface:AttributeMapGet the AttributeInfo with a given index.- Specified by:
itemAtin interfaceAttributeMap- Parameters:
index- the index position, zero-based. The order of index positions of attributes in an attribute map reflects document order.- Returns:
- the AttributeInfo at the given position. In an immutable tree the result will always
be equivalent to calling
asList().get(index). However, if the tree has been modified, then the index values of the attributes may not be contiguous.
-
-