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>
attribute
private java.util.Map<IType<?>,IMemberAccessor<? extends T,IItem>>
fieldsToMerge
private IMemberAccessor<? extends T,IItem>
lastField
private 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 T
getMember(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:IMemberAccessor
Gets a member value from a container object.- Specified by:
getMember
in interfaceIMemberAccessor<T,IItem>
- Parameters:
inObject
- Container object- Returns:
- member value or
null
if it can't be found from the provided container
-
-