Package org.openjdk.jmc.common.item
Class Attribute<T>
java.lang.Object
org.openjdk.jmc.common.item.Attribute<T>
- All Implemented Interfaces:
IDescribable
,IAccessorFactory<T>
,IAccessorKey<T>
,IAttribute<T>
,ICanonicalAccessorFactory<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final <T> IAttribute<T>
attr
(String identifier, String name, String description, ContentType<T> contentType) Obtain an attribute.static final <T> IAttribute<T>
attr
(String identifier, String name, ContentType<T> contentType) Obtain an attribute.static final <T> ICanonicalAccessorFactory<T>
attr
(String identifier, ContentType<T> contentType) static <T> IAttribute<T>
canonicalize
(Attribute<T> key) Setkey
as the canonical (and only allowed) attribute for its equivalence class.<U> IMemberAccessor<T,
U> customAccessor
(IType<U> type) Override to construct deriving accessors.boolean
final <U> IMemberAccessor<T,
U> getAccessor
(IType<U> type) Gets the accessor for specified type.The content type of this attribute.A identifier is a text string identifying the attribute.getKey()
getName()
int
hashCode()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.openjdk.jmc.common.item.ICanonicalAccessorFactory
getAccessor, getContentType, getIdentifier, getKey
-
Constructor Details
-
Attribute
Protected constructor. Use one of the parameterized factory methods instead.- Parameters:
identifier
- attribute idname
- attribute namedescription
- attribute descriptioncontentType
- content type of the attribute values- See Also:
-
-
Method Details
-
attr
public static final <T> IAttribute<T> attr(String identifier, String name, String description, ContentType<T> contentType) Obtain an attribute.- Type Parameters:
T
- attribute value type- Parameters:
identifier
- attribute idname
- attribute namedescription
- attribute descriptioncontentType
- content type of the attribute values- Returns:
- an attribute
-
attr
public static final <T> IAttribute<T> attr(String identifier, String name, ContentType<T> contentType) Obtain an attribute.- Type Parameters:
T
- attribute value type- Parameters:
identifier
- attribute idname
- attribute namecontentType
- content type of the attribute values- Returns:
- an attribute
-
attr
public static final <T> ICanonicalAccessorFactory<T> attr(String identifier, ContentType<T> contentType) -
canonicalize
Setkey
as the canonical (and only allowed) attribute for its equivalence class.- Type Parameters:
T
- attribute value type- Parameters:
key
- attribute to canonicalize- Returns:
- canonicalized attribute
- Throws:
IllegalStateException
- if an equivalent attribute has already been canonicalized
-
getName
- Specified by:
getName
in interfaceIDescribable
- Returns:
- the name of this object
-
getDescription
- Specified by:
getDescription
in interfaceIDescribable
- Returns:
- the description of this object
-
getAccessor
Description copied from interface:IAccessorFactory
Gets the accessor for specified type.- Specified by:
getAccessor
in interfaceIAccessorFactory<V>
- Specified by:
getAccessor
in interfaceICanonicalAccessorFactory<V>
- Type Parameters:
U
- input type class- Parameters:
type
- type that the accessor should work for- Returns:
- a member accessor or
null
if the type cannot provide such values
-
customAccessor
Override to construct deriving accessors. This will only be called when the type does not directly provide the attribute itself.- Type Parameters:
U
- input type class- Parameters:
type
- type to create accessor for- Returns:
- an accessor that works for the specified type or null if it can't be created
-
getKey
- Specified by:
getKey
in interfaceICanonicalAccessorFactory<V>
-
getContentType
Description copied from interface:IAccessorKey
The content type of this attribute. The type can be an opaque (or leaf) type in which case its instances can be of any class (but typically restricted according to the type). It can also be a structured type which has attributes (fields) of its own, in which case its instances currently must implementIItem
.- Specified by:
getContentType
in interfaceIAccessorKey<T>
- Returns:
- the content type of this attribute
-
getIdentifier
Description copied from interface:IAccessorKey
A identifier is a text string identifying the attribute. It must never be localized and it should only contain characters that are safe to use in various configuration files, e.g. as XML tags. (Analogous toField.getName()
.)- Specified by:
getIdentifier
in interfaceIAccessorKey<T>
- Returns:
- the attribute identifier
-
equals
-
hashCode
public int hashCode() -
toString
-