Package org.openjdk.jmc.common.item
Class CachingAccessor<T>
- java.lang.Object
-
- org.openjdk.jmc.common.item.CachingAccessor<T>
-
- Type Parameters:
T- the type of member values returned by this accessor
- All Implemented Interfaces:
IMemberAccessor<T,IItem>
class CachingAccessor<T> extends java.lang.Object implements IMemberAccessor<T,IItem>
An accessor that can be used for multiple types. It keeps a cache of accessors for the types of the items thatgetMember(org.openjdk.jmc.common.item.IItem)is called with.Note that this class is not thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description private IAccessorFactory<T>attributeprivate java.util.Map<IType<?>,IMemberAccessor<? extends T,IItem>>fieldsToMergeprivate IMemberAccessor<? extends T,IItem>lastFieldprivate IType<IItem>lastType
-
Constructor Summary
Constructors Constructor Description CachingAccessor(IAccessorFactory<T> attribute)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetMember(IItem inObject)Gets a member value from a container object.
-
-
-
Field Detail
-
attribute
private final IAccessorFactory<T> attribute
-
fieldsToMerge
private final java.util.Map<IType<?>,IMemberAccessor<? extends T,IItem>> fieldsToMerge
-
lastField
private IMemberAccessor<? extends T,IItem> lastField
-
-
Constructor Detail
-
CachingAccessor
CachingAccessor(IAccessorFactory<T> attribute)
-
-
Method Detail
-
getMember
public T getMember(IItem inObject)
Description copied from interface:IMemberAccessorGets a member value from a container object.- Specified by:
getMemberin interfaceIMemberAccessor<T,IItem>- Parameters:
inObject- Container object- Returns:
- member value or
nullif it can't be found from the provided container
-
-