T
- the type of the named attribute@Incubating public class Attribute<T> extends Object implements Named
AttributeContainer
to provide a type safe container for attributes. This class isn't intended to store the value of an
attribute, but only represent the identity of the attribute. It means that an attribute must be immutable
and can potentially be pooled. Attributes can be created using the factory method
.Named.Namer
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getName()
Returns the name of the attribute.
|
Class<T> |
getType()
Returns the type of this attribute.
|
int |
hashCode() |
static <T> Attribute<T> |
of(Class<T> type)
Creates a new attribute of the given type, inferring the name of the attribute from the simple type name.
|
static <T> Attribute<T> |
of(String name,
Class<T> type)
Creates a new attribute of the given name with the given type.
|
String |
toString() |
public static <T> Attribute<T> of(String name, Class<T> type)
Attribute
, so consumers are required to compare the attributes with the equals(Object)
method.T
- the type of the attributename
- the name of the attributetype
- the class of the attributepublic static <T> Attribute<T> of(Class<T> type)
Attribute
, so consumers are required to compare the attributes with the equals(Object)
method.T
- the type of the attributetype
- the class of the attributepublic String getName()
public Class<T> getType()