Helper for ClassNode and classes handling them. Contains a set of pre-defined instances for the most used types and some code for cached node creation and basic handling.
Modifiers | Name | Description |
---|---|---|
static ClassNode |
DYNAMIC_TYPE |
|
protected static ClassNode[] |
EMPTY_TYPE_ARRAY |
|
static String |
OBJECT |
|
static Class[] |
TUPLE_CLASSES |
Type Params | Return Type | Name and description |
---|---|---|
|
static MethodNode |
findSAM(ClassNode type) Returns the single abstract method of a class node, if it is a SAM type, or null otherwise. |
|
static ClassNode |
getNextSuperClass(ClassNode clazz, ClassNode goalClazz) Returns a super class or interface for a given class depending on a given target. |
|
static ClassNode |
getUnwrapper(ClassNode cn) |
|
static ClassNode |
getWrapper(ClassNode cn) Creates a ClassNode containing the wrapper of a ClassNode of primitive type. |
|
static boolean |
isCachedType(ClassNode type) |
|
static boolean |
isFunctionalInterface(ClassNode type) |
|
static boolean |
isGeneratedFunction(ClassNode type) Checks if the type is a generated function, i.e. closure or lambda. |
|
static boolean |
isNumberType(ClassNode cn) |
|
static boolean |
isPrimitiveType(ClassNode cn) Test to determine if a ClassNode is a primitive type. |
|
static boolean |
isSAMType(ClassNode type) |
|
static boolean |
isStaticConstantInitializerType(ClassNode cn) Test to determine if a ClassNode is a type belongs to the list of types which are allowed to initialize constants directly in bytecode instead of using <cinit> |
|
static ClassNode[] |
make(Class[] classes) Creates an array of ClassNodes using an array of classes. |
|
static ClassNode |
make(Class c) Creates a ClassNode using a given class. |
|
static ClassNode |
make(Class c, boolean includeGenerics) |
|
static ClassNode |
make(String name) Creates a ClassNode using a given class. |
|
static ClassNode |
makeCached(Class c) |
|
static ClassNode |
makeReference() |
|
static ClassNode |
makeWithoutCaching(Class c) |
|
static ClassNode |
makeWithoutCaching(Class c, boolean includeGenerics) |
|
static ClassNode |
makeWithoutCaching(String name) Creates a ClassNode using a given class. |
Returns the single abstract method of a class node, if it is a SAM type, or null otherwise.
type
- a type for which to search for a single abstract methodReturns a super class or interface for a given class depending on a given target. If the target is no super class or interface, then null will be returned. For a non-primitive array type, returns an array of the componentType's super class or interface if the target is also an array.
clazz
- the start classgoalClazz
- the goal classCreates a ClassNode containing the wrapper of a ClassNode of primitive type. Any ClassNode representing a primitive type should be created using the predefined types used in class. The method will check the parameter for known references of ClassNode representing a primitive type. If Reference is found, then a ClassNode will be contained that represents the wrapper class. For example for boolean, the wrapper class is java.lang.Boolean.
If the parameter is no primitive type, the redirected ClassNode will be returned
cn
- the ClassNode containing a possible primitive typeChecks if the type is a generated function, i.e. closure or lambda.
Test to determine if a ClassNode is a primitive type. Note: this only works for ClassNodes created using a predefined ClassNode
cn
- the ClassNode containing a possible primitive typeTest to determine if a ClassNode is a type belongs to the list of types which are allowed to initialize constants directly in bytecode instead of using <cinit>
Note: this only works for ClassNodes created using a predefined ClassNode
cn
- the ClassNode to be testedCreates an array of ClassNodes using an array of classes. For each of the given classes a new ClassNode will be created
classes
- an array of classes used to create the ClassNodesCreates a ClassNode using a given class. A new ClassNode object is only created if the class is not one of the predefined ones
c
- class used to created the ClassNodeCreates a ClassNode using a given class. If the name is one of the predefined ClassNodes then the corresponding ClassNode instance will be returned. If the name is null or of length 0 the dynamic type is returned
name
- of the class the ClassNode is representingCreates a ClassNode using a given class. Unlike make(String) this method will not use the cache to create the ClassNode. This means the ClassNode created from this method using the same name will have a different reference
name
- of the class the ClassNode is representing