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,UnitLookup.LeafContentType
public class ContentType<T> extends java.lang.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 private java.util.List<DisplayFormatter<T>>m_formattersprotected java.lang.Stringm_identifierprivate java.lang.Stringm_localizedName
-
Constructor Summary
Constructors Constructor Description ContentType(java.lang.String identifier)ContentType(java.lang.String identifier, java.lang.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.java.util.Map<IAccessorKey<?>,? extends IDescribable>getAccessorKeys()Get keys for the accessors that this type knows of.java.util.List<IAttribute<?>>getAttributes()IFormatter<T>getDefaultFormatter()java.lang.StringgetDescription()IFormatter<T>getFormatter(java.lang.String formatterIdentifier)java.util.List<DisplayFormatter<T>>getFormatters()java.lang.StringgetIdentifier()String identifying the type.java.lang.StringgetName()IPersister<T>getPersister()booleanhasAttribute(ICanonicalAccessorFactory<?> attribute)protected static java.lang.StringlookupNameFor(java.lang.String typeIdentifier)java.lang.StringtoString()
-
-
-
Field Detail
-
m_formatters
private final java.util.List<DisplayFormatter<T>> m_formatters
-
m_identifier
protected final java.lang.String m_identifier
-
m_localizedName
private final java.lang.String m_localizedName
-
-
Method Detail
-
addFormatter
protected void addFormatter(DisplayFormatter<T> formatter)
-
getFormatters
public java.util.List<DisplayFormatter<T>> getFormatters()
-
getDefaultFormatter
public IFormatter<T> getDefaultFormatter()
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceIDescribable- Returns:
- the name of this object
-
getIdentifier
public java.lang.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(java.lang.String formatterIdentifier)
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescriptionin interfaceIDescribable- Returns:
- the description of this object
-
getAttributes
public java.util.List<IAttribute<?>> getAttributes()
- Specified by:
getAttributesin interfaceIType<T>
-
getAccessorKeys
public java.util.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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
lookupNameFor
protected static java.lang.String lookupNameFor(java.lang.String typeIdentifier)
-
-