Package com.comphenix.protocol.wrappers
Class TroveWrapper
java.lang.Object
com.comphenix.protocol.wrappers.TroveWrapper
Wrap a GNU Trove Collection class with an equivalent Java Collection class.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <TValue> List<TValue> getDecoratedList(Object troveList) Retrieve a Java wrapper for the corresponding Trove list.static <TKey,TValue>
Map<TKey, TValue> getDecoratedMap(Object troveMap) Retrieve a Java wrapper for the corresponding Trove map.static <TValue> Set<TValue> getDecoratedSet(Object troveSet) Retrieve a Java wrapper for the corresponding Trove set.static booleanisTroveClass(Class<?> clazz) Determine if the given class is found within gnu.trove.static FieldAccessorwrapMapField(FieldAccessor accessor) Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.static FieldAccessorwrapMapField(FieldAccessor accessor, com.google.common.base.Function<Integer, Integer> noEntryTransform) Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.
-
Constructor Details
-
TroveWrapper
public TroveWrapper()
-
-
Method Details
-
wrapMapField
Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.- Parameters:
accessor- - the accessor.- Returns:
- The read only accessor.
-
wrapMapField
public static FieldAccessor wrapMapField(FieldAccessor accessor, com.google.common.base.Function<Integer, Integer> noEntryTransform) Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.- Parameters:
accessor- - the accessor.noEntryTransform- - transform the no entry value, or NULL to ignore.- Returns:
- The read only accessor.
-
getDecoratedMap
Retrieve a Java wrapper for the corresponding Trove map.- Type Parameters:
TKey- Key typeTValue- Value type- Parameters:
troveMap- - the trove map to wrap.- Returns:
- The wrapped GNU Trove map.
- Throws:
IllegalStateException- If GNU Trove cannot be found in the class map.IllegalArgumentException- If troveMap is NULL.FieldAccessException- Error in wrapper method or lack of reflection permissions.
-
getDecoratedSet
Retrieve a Java wrapper for the corresponding Trove set.- Type Parameters:
TValue- Type- Parameters:
troveSet- - the trove set to wrap.- Returns:
- The wrapped GNU Trove set.
- Throws:
IllegalStateException- If GNU Trove cannot be found in the class map.IllegalArgumentException- If troveSet is NULL.FieldAccessException- Error in wrapper method or lack of reflection permissions.
-
getDecoratedList
Retrieve a Java wrapper for the corresponding Trove list.- Type Parameters:
TValue- Type- Parameters:
troveList- - the trove list to wrap.- Returns:
- The wrapped GNU Trove list.
- Throws:
IllegalStateException- If GNU Trove cannot be found in the class map.IllegalArgumentException- If troveList is NULL.FieldAccessException- Error in wrapper method or lack of reflection permissions.
-
isTroveClass
Determine if the given class is found within gnu.trove.- Parameters:
clazz- - the clazz.- Returns:
- TRUE if it is, FALSE otherwise.
-