public final class PainlessLookupUtility
extends java.lang.Object
PainlessLookupBuilder, PainlessLookup, and other classes within
Painless for conversion between type names and types along with some other various utility methods.
The following terminology is used for variable names throughout the lookup package:
A class is a set of methods and fields under a specific class name. A type is either a class or an array under a specific type name.
Note the distinction between class versus type is class means that no array classes will be be represented whereas type allows array
classes to be represented. The set of available classes will always be a subset of the available types.
Under ambiguous circumstances most variable names are prefixed with asm, java, or painless. If the variable value is the same for asm,
java, and painless, no prefix is used. Target is used as a prefix to represent if a constructor, method, or field is being
called/accessed on that specific class. Parameter is often a postfix used to represent if a type is used as a parameter to a
constructor, method, or field.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ANONYMOUS_CLASS_NAME
The name for an anonymous class.
|
static java.lang.String |
CONSTRUCTOR_NAME
The method name for all constructors.
|
static java.lang.String |
DEF_CLASS_NAME
The def type name as specified in the source for a script.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
buildPainlessConstructorKey(int constructorArity)
Constructs a painless constructor key used to lookup painless constructors from a painless class.
|
static java.lang.String |
buildPainlessFieldKey(java.lang.String fieldName)
Constructs a painless field key used to lookup painless fields from a painless class.
|
static java.lang.String |
buildPainlessMethodKey(java.lang.String methodName,
int methodArity)
Constructs a painless method key used to lookup painless methods from a painless class.
|
static java.lang.Class<?> |
canonicalTypeNameToType(java.lang.String canonicalTypeName,
java.util.Map<java.lang.String,java.lang.Class<?>> canonicalClassNamesToClasses)
Converts a canonical type name to a type based on the terminology specified as part of the documentation for
PainlessLookupUtility. |
static boolean |
isConstantType(java.lang.Class<?> type)
Checks if a type based on the terminology specified as part of
PainlessLookupUtility is available as a constant type
where true is returned if the type is a constant type and false otherwise. |
static java.lang.Class<?> |
javaTypeToType(java.lang.Class<?> javaType)
Converts a java type to a type based on the terminology specified as part of
PainlessLookupUtility where if a type is an
object class or object array, the returned type will be the equivalent def class or def array. |
static java.lang.String |
typesToCanonicalTypeNames(java.util.List<java.lang.Class<?>> types)
Converts a list of types to a list of canonical type names as a string based on the terminology specified as part of the
documentation for
PainlessLookupUtility. |
static java.lang.Class<?> |
typeToBoxedType(java.lang.Class<?> type)
Converts a type to its boxed type equivalent if one exists based on the terminology specified as part of
PainlessLookupUtility. |
static java.lang.String |
typeToCanonicalTypeName(java.lang.Class<?> type)
Converts a type to a canonical type name based on the terminology specified as part of the documentation for
PainlessLookupUtility. |
static java.lang.Class<?> |
typeToJavaType(java.lang.Class<?> type)
Converts a type to a java type based on the terminology specified as part of
PainlessLookupUtility where if a type is a
def class or def array, the returned type will be the equivalent object class or object array. |
static java.lang.Class<?> |
typeToUnboxedType(java.lang.Class<?> type)
Converts a type to its unboxed type equivalent if one exists based on the terminology specified as part of
PainlessLookupUtility. |
public static final java.lang.String ANONYMOUS_CLASS_NAME
public static final java.lang.String DEF_CLASS_NAME
public static final java.lang.String CONSTRUCTOR_NAME
public static java.lang.Class<?> canonicalTypeNameToType(java.lang.String canonicalTypeName,
java.util.Map<java.lang.String,java.lang.Class<?>> canonicalClassNamesToClasses)
PainlessLookupUtility. Since canonical class names are a subset of canonical type names, this method will
safely convert a canonical class name to a class as well.public static java.lang.String typeToCanonicalTypeName(java.lang.Class<?> type)
PainlessLookupUtility. Since classes are a subset of types, this method will safely convert a class
to a canonical class name as well.public static java.lang.String typesToCanonicalTypeNames(java.util.List<java.lang.Class<?>> types)
PainlessLookupUtility. Since classes are a subset of types, this method will safely convert a list
of classes or a mixed list of classes and types to a list of canonical type names as a string as well.public static java.lang.Class<?> javaTypeToType(java.lang.Class<?> javaType)
PainlessLookupUtility where if a type is an
object class or object array, the returned type will be the equivalent def class or def array. Otherwise, this behaves as an
identity function.public static java.lang.Class<?> typeToJavaType(java.lang.Class<?> type)
PainlessLookupUtility where if a type is a
def class or def array, the returned type will be the equivalent object class or object array. Otherwise, this behaves as an
identity function.public static java.lang.Class<?> typeToBoxedType(java.lang.Class<?> type)
PainlessLookupUtility. Otherwise, this behaves as an identity function.public static java.lang.Class<?> typeToUnboxedType(java.lang.Class<?> type)
PainlessLookupUtility. Otherwise, this behaves as an identity function.public static boolean isConstantType(java.lang.Class<?> type)
PainlessLookupUtility is available as a constant type
where true is returned if the type is a constant type and false otherwise.public static java.lang.String buildPainlessConstructorKey(int constructorArity)
public static java.lang.String buildPainlessMethodKey(java.lang.String methodName,
int methodArity)
public static java.lang.String buildPainlessFieldKey(java.lang.String fieldName)