@Override public Object get(Object instance) { Object troveMap = accessor.get(instance); // Apply transform as well if (noEntryTransform != null) TroveWrapper.transformNoEntryValue(troveMap, noEntryTransform); return getDecoratedMap(troveMap); } @Override
/** * Determine if the given class is found within gnu.trove. * @param clazz - the clazz. * @return TRUE if it is, FALSE otherwise. */ public static boolean isTroveClass(Class<?> clazz) { return getClassSource(clazz) != null; }
/** * Retrieve a Java wrapper for the corresponding Trove list. * @param <TValue> Type * @param troveList - the trove list to wrap. * @return The wrapped GNU Trove list. * @throws IllegalStateException If GNU Trove cannot be found in the class map. * @throws IllegalArgumentException If troveList is NULL. * @throws FieldAccessException Error in wrapper method or lack of reflection permissions. */ public static <TValue> List<TValue> getDecoratedList(@Nonnull Object troveList) { @SuppressWarnings("unchecked") List<TValue> result = (List<TValue>) getDecorated(troveList); return result; }
/** * Retrieve a read-only field accessor that automatically wraps the underlying Trove instance. * @param accessor - the accessor. * @return The read only accessor. */ public static ReadOnlyFieldAccessor wrapMapField(final FieldAccessor accessor) { return wrapMapField(accessor, null); }
@Override public Object get(Object instance) { return getDecoratedSet(accessor.get(instance)); } @Override
@Override public Object get(Object instance) { return getDecoratedList(accessor.get(instance)); } @Override
TroveWrapper.transformNoEntryValue(troveMap, new Function<Integer, Integer>() { public Integer apply(Integer value) { if (value >= 0 && value < 256) { return TroveWrapper.getDecoratedMap(troveMap);
/** * Retrieve a Java wrapper for the corresponding Trove set. * @param <TValue> Type * @param troveSet - the trove set to wrap. * @return The wrapped GNU Trove set. * @throws IllegalStateException If GNU Trove cannot be found in the class map. * @throws IllegalArgumentException If troveSet is NULL. * @throws FieldAccessException Error in wrapper method or lack of reflection permissions. */ public static <TValue> Set<TValue> getDecoratedSet(@Nonnull Object troveSet) { @SuppressWarnings("unchecked") Set<TValue> result = (Set<TValue>) getDecorated(troveSet); return result; }
decorators = getClassSource(trove.getClass()).loadClass("TDecorators"); } catch (ClassNotFoundException e) { throw new IllegalStateException(e.getMessage(), e);
/** * Retrieve a Java wrapper for the corresponding Trove map. * @param <TKey> Key type * @param <TValue> Value type * @param troveMap - the trove map to wrap. * @return The wrapped GNU Trove map. * @throws IllegalStateException If GNU Trove cannot be found in the class map. * @throws IllegalArgumentException If troveMap is NULL. * @throws FieldAccessException Error in wrapper method or lack of reflection permissions. */ public static <TKey, TValue> Map<TKey, TValue> getDecoratedMap(@Nonnull Object troveMap) { @SuppressWarnings("unchecked") Map<TKey, TValue> result = (Map<TKey, TValue>) getDecorated(troveMap); return result; }