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 String
m_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 void
addFormatter(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()
String
getDescription()
IFormatter<T>
getFormatter(String formatterIdentifier)
List<DisplayFormatter<T>>
getFormatters()
String
getIdentifier()
String identifying the type.String
getName()
IPersister<T>
getPersister()
boolean
hasAttribute(ICanonicalAccessorFactory<?> attribute)
protected static String
lookupNameFor(String typeIdentifier)
String
toString()
-
-
-
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:
getName
in interfaceIDescribable
- Returns:
- the name of this object
-
getIdentifier
public String getIdentifier()
Description copied from interface:IType
String 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:
getIdentifier
in interfaceIType<T>
- Returns:
- type identifier
-
getPersister
public IPersister<T> getPersister()
-
getFormatter
public IFormatter<T> getFormatter(String formatterIdentifier)
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceIDescribable
- Returns:
- the description of this object
-
getAttributes
public List<IAttribute<?>> getAttributes()
- Specified by:
getAttributes
in interfaceIType<T>
-
getAccessorKeys
public Map<IAccessorKey<?>,? extends IDescribable> getAccessorKeys()
Description copied from interface:IType
Get 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:
getAccessorKeys
in interfaceIType<T>
- Returns:
- keys for the accessors defined for this type
-
hasAttribute
public boolean hasAttribute(ICanonicalAccessorFactory<?> attribute)
Description copied from interface:IType
Tell ifattribute
can return anaccessor
for thistype
. This method is semantically equivalent toattribute.
, but may be cheaper.getAccessor(type)
!= null- Specified by:
hasAttribute
in interfaceIType<T>
- Parameters:
attribute
- attribute to check- Returns:
true
if the attribute can return an accessor for this type,false
if not
-
getAccessor
public <M> IMemberAccessor<M,T> getAccessor(IAccessorKey<M> attribute)
Description copied from interface:IType
Internal 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:
getAccessor
in interfaceIType<T>
- Type Parameters:
M
- accessor value type- Parameters:
attribute
- the identifier for the field- Returns:
- a member accessor
-
-