public class ReflectionUtils
extends java.lang.Object
Constructor and Description |
---|
ReflectionUtils() |
Modifier and Type | Method and Description |
---|---|
static <K,V> void |
clearMapField(java.lang.Class<?> clazz,
java.lang.Object instance,
java.lang.String mapName,
java.util.function.Predicate<java.util.Map.Entry<K,V>> shouldRemove)
Used by the in-jvm dtest framework to remove entries from private map fields that otherwise would prevent
collection of classloaders (which causes metaspace OOMs) or otherwise interfere with instance restart.
|
static java.lang.reflect.Field |
getField(java.lang.Class<?> clazz,
java.lang.String fieldName) |
public static java.lang.reflect.Field getField(java.lang.Class<?> clazz, java.lang.String fieldName) throws java.lang.NoSuchFieldException
java.lang.NoSuchFieldException
public static <K,V> void clearMapField(java.lang.Class<?> clazz, java.lang.Object instance, java.lang.String mapName, java.util.function.Predicate<java.util.Map.Entry<K,V>> shouldRemove)
K
- The type of the map keyV
- The type of the map valueclazz
- The class which has the map field to clearinstance
- an instance of the class to clear (pass null for a static member)mapName
- the name of the map field to clearshouldRemove
- a predicate which determines if the entry in question should be removedCopyright © 2009- The Apache Software Foundation