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.
- Author:
- Kristian
-
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 voidtransformNoEntryValue(Object troveMap, com.google.common.base.Function<Integer,Integer> transform)Transform the no entry value in the given map.static ReadOnlyFieldAccessorwrapListField(FieldAccessor accessor)Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.static ReadOnlyFieldAccessorwrapMapField(FieldAccessor accessor)Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.static ReadOnlyFieldAccessorwrapMapField(FieldAccessor accessor, com.google.common.base.Function<Integer,Integer> noEntryTransform)Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.static ReadOnlyFieldAccessorwrapSetField(FieldAccessor accessor)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 ReadOnlyFieldAccessor 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.
-
wrapSetField
Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.- Parameters:
accessor- - the accessor.- Returns:
- The read only accessor.
-
wrapListField
Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.- Parameters:
accessor- - the accessor.- 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.
-
transformNoEntryValue
public static void transformNoEntryValue(Object troveMap, com.google.common.base.Function<Integer,Integer> transform)Transform the no entry value in the given map.- Parameters:
troveMap- - the trove map.transform- - the transform.
-