public class ClassHelper extends Object
Constructor and Description |
---|
ClassHelper() |
Modifier and Type | Method 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 |
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>
Note: this only works for ClassNodes created using a
predefined ClassNode
|
static ClassNode |
make(Class c)
Creates a ClassNode using a given class.
|
static ClassNode[] |
make(Class[] classes)
Creates an array of ClassNodes using an array of classes.
|
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.
|
public static final ClassNode DYNAMIC_TYPE
public static final ClassNode OBJECT_TYPE
public static final ClassNode VOID_TYPE
public static final ClassNode CLOSURE_TYPE
public static final ClassNode GSTRING_TYPE
public static final ClassNode LIST_TYPE
public static final ClassNode MAP_TYPE
public static final ClassNode RANGE_TYPE
public static final ClassNode PATTERN_TYPE
public static final ClassNode STRING_TYPE
public static final ClassNode SCRIPT_TYPE
public static final ClassNode REFERENCE_TYPE
public static final ClassNode BINDING_TYPE
public static final ClassNode boolean_TYPE
public static final ClassNode char_TYPE
public static final ClassNode byte_TYPE
public static final ClassNode int_TYPE
public static final ClassNode long_TYPE
public static final ClassNode short_TYPE
public static final ClassNode double_TYPE
public static final ClassNode float_TYPE
public static final ClassNode Byte_TYPE
public static final ClassNode Short_TYPE
public static final ClassNode Integer_TYPE
public static final ClassNode Long_TYPE
public static final ClassNode Character_TYPE
public static final ClassNode Float_TYPE
public static final ClassNode Double_TYPE
public static final ClassNode Boolean_TYPE
public static final ClassNode BigInteger_TYPE
public static final ClassNode BigDecimal_TYPE
public static final ClassNode Number_TYPE
public static final ClassNode void_WRAPPER_TYPE
public static final ClassNode METACLASS_TYPE
public static final ClassNode Iterator_TYPE
public static final ClassNode CLASS_Type
public static final ClassNode COMPARABLE_TYPE
public static final ClassNode GENERATED_CLOSURE_Type
public static final ClassNode GROOVY_OBJECT_SUPPORT_TYPE
public static final ClassNode GROOVY_OBJECT_TYPE
public static final ClassNode GROOVY_INTERCEPTABLE_TYPE
public static final ClassNode Enum_Type
public static final ClassNode Annotation_TYPE
public static final ClassNode ELEMENT_TYPE_TYPE
protected static final ClassNode[] EMPTY_TYPE_ARRAY
public static final String OBJECT
public static ClassNode[] make(Class[] classes)
classes
- an array of classes used to create the ClassNodesmake(Class)
public static ClassNode make(Class c)
c
- class used to created the ClassNodepublic static ClassNode makeWithoutCaching(String name)
name
- of the class the ClassNode is representingmake(String)
public static ClassNode make(String name)
name
- of the class the ClassNode is representingpublic static ClassNode getWrapper(ClassNode cn)
cn
- the ClassNode containing a possible primitive typemake(Class)
,
make(String)
public static boolean isPrimitiveType(ClassNode cn)
cn
- the ClassNode containing a possible primitive typemake(Class)
,
make(String)
public static boolean isStaticConstantInitializerType(ClassNode cn)
cn
- the ClassNode to be testedmake(Class)
,
make(String)
public static boolean isNumberType(ClassNode cn)
public static ClassNode makeReference()
public static boolean isCachedType(ClassNode type)
public static boolean isSAMType(ClassNode type)
public static MethodNode findSAM(ClassNode type)
type
- a type for which to search for a single abstract methodpublic static ClassNode getNextSuperClass(ClassNode clazz, ClassNode goalClazz)
clazz
- the start classgoalClazz
- the goal class