@Immutable public class AttributeSet extends java.util.AbstractSet<TypedName<?>> implements java.io.Serializable
A set of attributes. Attributes are mapped to positions. If CommonAttributes.ENTITY_ID
is in the set, it is always at position 0. Iteration is in order.
This class exists for two reasons:
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.lang.Object o) |
static AttributeSet |
create(java.util.List<? extends TypedName<?>> names)
Create a new attribute set.
|
static AttributeSet |
create(TypedName<?>... names)
Create a new attribute set.
|
TypedName<?> |
getAttribute(int idx)
Get the type name for an attribute by index.
|
java.util.Iterator<TypedName<?>> |
iterator() |
int |
lookup(java.lang.String name)
Look up an attribute.
|
int |
lookup(TypedName<?> name)
Look up an attribute.
|
int |
lookup(TypedName<?> name,
boolean matchSubclasses)
Look up an attribute.
|
java.util.Set<java.lang.String> |
nameSet()
Get a set-of-strings view of this attribute set.
|
int |
size()
Get the number of attributes in this set.
|
add, addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public static AttributeSet create(TypedName<?>... names)
Create a new attribute set.
names
- The list of attributes.public static AttributeSet create(java.util.List<? extends TypedName<?>> names)
Create a new attribute set.
names
- The list of attributes.public int lookup(TypedName<?> name)
Look up an attribute.
name
- The attribute.public int lookup(TypedName<?> name, boolean matchSubclasses)
Look up an attribute.
name
- The attribute.matchSubclasses
- If true, then attributes whose types are subclasses of name
’s type will also match.public int lookup(java.lang.String name)
Look up an attribute.
name
- The attribute name.public TypedName<?> getAttribute(int idx)
Get the type name for an attribute by index.
idx
- The attribute index.public java.util.Iterator<TypedName<?>> iterator()
public boolean contains(java.lang.Object o)
public int size()
Get the number of attributes in this set.
public java.util.Set<java.lang.String> nameSet()
Get a set-of-strings view of this attribute set.