Package org.openjdk.jmc.common.item
Class Attribute<T>
- java.lang.Object
-
- org.openjdk.jmc.common.item.AccessorKey<V>
-
- org.openjdk.jmc.common.item.CanonicalAccessorFactory<T>
-
- org.openjdk.jmc.common.item.Attribute<T>
-
- All Implemented Interfaces:
IDescribable
,IAccessorFactory<T>
,IAccessorKey<T>
,IAttribute<T>
,ICanonicalAccessorFactory<T>
public class Attribute<T> extends CanonicalAccessorFactory<T> implements IAttribute<T>
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<IAccessorKey<?>,IAttribute<?>>
CANONICAL_MAP
private java.lang.String
description
private java.lang.String
name
-
Constructor Summary
Constructors Modifier Constructor Description protected
Attribute(java.lang.String identifier, java.lang.String name, java.lang.String description, ContentType<T> contentType)
Protected constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> IAttribute<T>
attr(java.lang.String identifier, java.lang.String name, java.lang.String description, ContentType<T> contentType)
Obtain an attribute.static <T> IAttribute<T>
attr(java.lang.String identifier, java.lang.String name, ContentType<T> contentType)
Obtain an attribute.static <T> ICanonicalAccessorFactory<T>
attr(java.lang.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.private static <T> IAttribute<T>
getCanonical(Attribute<T> key)
If the attributekey
has a canonical equivalent, get that.private static <T> ICanonicalAccessorFactory<T>
getCanonical(CanonicalAccessorFactory<T> key)
If the attributekey
has a canonical equivalent, get that.java.lang.String
getDescription()
java.lang.String
getName()
-
Methods inherited from class org.openjdk.jmc.common.item.CanonicalAccessorFactory
customAccessor, getAccessor, getKey
-
Methods inherited from class org.openjdk.jmc.common.item.AccessorKey
equals, getContentType, getIdentifier, 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
-
-
-
-
Field Detail
-
CANONICAL_MAP
private static java.util.Map<IAccessorKey<?>,IAttribute<?>> CANONICAL_MAP
-
name
private final java.lang.String name
-
description
private final java.lang.String description
-
-
Constructor Detail
-
Attribute
protected Attribute(java.lang.String identifier, java.lang.String name, java.lang.String description, ContentType<T> contentType)
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:
attr(String, String, String, ContentType)
,attr(String, String, ContentType)
-
-
Method Detail
-
attr
public static final <T> IAttribute<T> attr(java.lang.String identifier, java.lang.String name, java.lang.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(java.lang.String identifier, java.lang.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(java.lang.String identifier, ContentType<T> contentType)
-
getCanonical
private static <T> ICanonicalAccessorFactory<T> getCanonical(CanonicalAccessorFactory<T> key)
If the attributekey
has a canonical equivalent, get that. Otherwise, usekey
.- Parameters:
key
-- Returns:
key
or a canonical equivalent
-
getCanonical
private static <T> IAttribute<T> getCanonical(Attribute<T> key)
If the attributekey
has a canonical equivalent, get that. Otherwise, usekey
.- Parameters:
key
-- Returns:
key
or a canonical equivalent
-
canonicalize
public static <T> IAttribute<T> canonicalize(Attribute<T> key)
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:
java.lang.IllegalStateException
- if an equivalent attribute has already been canonicalized
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceIDescribable
- Returns:
- the name of this object
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceIDescribable
- Returns:
- the description of this object
-
-