Package org.openjdk.jmc.common.unit
Class ContentType<T>
- java.lang.Object
-
- org.openjdk.jmc.common.unit.ContentType<T>
-
- Type Parameters:
T- the type of values that the content type is used for
- All Implemented Interfaces:
IDescribable,IType<T>
- Direct Known Subclasses:
KindOfQuantity,StructContentType
public class ContentType<T> extends Object implements IType<T>
A content type describes what kind of data a value is. It's not specific unit, like seconds/minutes or bytes/MB, but it could be time or memory.Data values of the same content type should be able share a single axis in a graph.
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_identifier
-
Constructor Summary
Constructors Constructor Description ContentType(String identifier, String localizedName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddFormatter(DisplayFormatter<T> formatter)<M> IMemberAccessor<M,T>getAccessor(IAccessorKey<M> attribute)Internal low-level mechanism for retrieving a member accessor for a type, or null if not available.Map<IAccessorKey<?>,? extends IDescribable>getAccessorKeys()Get keys for the accessors that this type knows of.List<IAttribute<?>>getAttributes()IFormatter<T>getDefaultFormatter()StringgetDescription()IFormatter<T>getFormatter(String formatterIdentifier)List<DisplayFormatter<T>>getFormatters()StringgetIdentifier()String identifying the type.StringgetName()IPersister<T>getPersister()booleanhasAttribute(ICanonicalAccessorFactory<?> attribute)protected static StringlookupNameFor(String typeIdentifier)StringtoString()
-
-
-
Field Detail
-
m_identifier
protected final String m_identifier
-
-
Method Detail
-
addFormatter
protected void addFormatter(DisplayFormatter<T> formatter)
-
getFormatters
public List<DisplayFormatter<T>> getFormatters()
-
getDefaultFormatter
public IFormatter<T> getDefaultFormatter()
-
getName
public String getName()
- Specified by:
getNamein interfaceIDescribable- Returns:
- the name of this object
-
getIdentifier
public String getIdentifier()
Description copied from interface:ITypeString identifying the type. It must never be localized and it should only contain characters that are safe to use in various configuration files, e.g. in XML.- Specified by:
getIdentifierin interfaceIType<T>- Returns:
- type identifier
-
getPersister
public IPersister<T> getPersister()
-
getFormatter
public IFormatter<T> getFormatter(String formatterIdentifier)
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceIDescribable- Returns:
- the description of this object
-
getAttributes
public List<IAttribute<?>> getAttributes()
- Specified by:
getAttributesin interfaceIType<T>
-
getAccessorKeys
public Map<IAccessorKey<?>,? extends IDescribable> getAccessorKeys()
Description copied from interface:ITypeGet keys for the accessors that this type knows of. Note that the returned accessors does not necessarily cover all possible data from the items of this type, and that it is always possible to define additional accessors that get or calculate values from the items in non-standard ways.Should only be used for low level type inspection. Iterators etc. should use a collection of predefined
attributes.- Specified by:
getAccessorKeysin interfaceIType<T>- Returns:
- keys for the accessors defined for this type
-
hasAttribute
public boolean hasAttribute(ICanonicalAccessorFactory<?> attribute)
Description copied from interface:ITypeTell ifattributecan return anaccessorfor thistype. This method is semantically equivalent toattribute., but may be cheaper.getAccessor(type)!= null- Specified by:
hasAttributein interfaceIType<T>- Parameters:
attribute- attribute to check- Returns:
trueif the attribute can return an accessor for this type,falseif not
-
getAccessor
public <M> IMemberAccessor<M,T> getAccessor(IAccessorKey<M> attribute)
Description copied from interface:ITypeInternal low-level mechanism for retrieving a member accessor for a type, or null if not available.This is only intended to be used by implementors of
IAccessorFactory. All other usage should be replaced withICanonicalAccessorFactory.getAccessor(IType)call to pre-defined accessors.- Specified by:
getAccessorin interfaceIType<T>- Type Parameters:
M- accessor value type- Parameters:
attribute- the identifier for the field- Returns:
- a member accessor
-
-