Class TroveWrapper

java.lang.Object
com.comphenix.protocol.wrappers.TroveWrapper

public class TroveWrapper extends Object
Wrap a GNU Trove Collection class with an equivalent Java Collection class.
  • Constructor Details

    • TroveWrapper

      public TroveWrapper()
  • Method Details

    • wrapMapField

      public static FieldAccessor wrapMapField(FieldAccessor accessor)
      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

      public static <TKey, TValue> Map<TKey,TValue> getDecoratedMap(@Nonnull Object troveMap)
      Retrieve a Java wrapper for the corresponding Trove map.
      Type Parameters:
      TKey - Key type
      TValue - 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

      public static <TValue> Set<TValue> getDecoratedSet(@Nonnull Object troveSet)
      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

      public static <TValue> List<TValue> getDecoratedList(@Nonnull Object troveList)
      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

      public static boolean isTroveClass(Class<?> clazz)
      Determine if the given class is found within gnu.trove.
      Parameters:
      clazz - - the clazz.
      Returns:
      TRUE if it is, FALSE otherwise.