| |
|
| java.lang.Object org.codehaus.groovy.ast.ClassHelper
ClassHelper | public class ClassHelper (Code) | | This class is a Helper for ClassNode and classes handling ClassNodes.
It does contain a set of predefined ClassNodes for the most used
types and some code for cached ClassNode creation and basic
ClassNode handling
author: Jochen Theodorou |
Method Summary | |
public static ClassNode | getWrapper(ClassNode cn) Creates a ClassNode containing the wrapper of a ClassNode
of primitive type. | public static boolean | isPrimitiveType(ClassNode cn) Test to determine if a ClasNode is a primitve type. | public static ClassNode[] | make(Class[] classes) Creates an array of ClassNodes using an array of classes. | public static ClassNode | make(Class c) Creates a ClassNode using a given class. | public static ClassNode | make(String name) Creates a ClassNode using a given class.
If the name is one of the predefined ClassNodes then the
corresponding ClassNode instance will be returned. | public static ClassNode | makeReference() | public static ClassNode | makeWithoutCaching(String name) Creates a ClassNode using a given class.
Unlike make(String) this method will not use the cache
to create the ClassNode. |
DYNAMIC_TYPEOBJECT_TYPEVOID_TYPECLOSURE_TYPEGSTRING_TYPELIST_TYPEMAP_TYPERANGE_TYPEPATTERN_TYPESTRING_TYPESCRIPT_TYPEREFERENCE_TYPEboolean_TYPEchar_TYPEbyte_TYPEint_TYPElong_TYPEshort_TYPEdouble_TYPEfloat_TYPEByte_TYPEShort_TYPEInteger_TYPELong_TYPECharacter_TYPEFloat_TYPEDouble_TYPEBoolean_TYPEBigInteger_TYPEBigDecimal_TYPEvoid_WRAPPER_TYPECLASS_TypeMETACLASS_TYPE | final public static ClassNode DYNAMIC_TYPEOBJECT_TYPEVOID_TYPECLOSURE_TYPEGSTRING_TYPELIST_TYPEMAP_TYPERANGE_TYPEPATTERN_TYPESTRING_TYPESCRIPT_TYPEREFERENCE_TYPEboolean_TYPEchar_TYPEbyte_TYPEint_TYPElong_TYPEshort_TYPEdouble_TYPEfloat_TYPEByte_TYPEShort_TYPEInteger_TYPELong_TYPECharacter_TYPEFloat_TYPEDouble_TYPEBoolean_TYPEBigInteger_TYPEBigDecimal_TYPEvoid_WRAPPER_TYPECLASS_TypeMETACLASS_TYPE(Code) | | |
getWrapper | public static ClassNode getWrapper(ClassNode cn)(Code) | | Creates 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 exmaple for boolean, the
wrapper class is java.lang.Boolean.
If the parameter is no primitve type, the redirected
ClassNode will be returned
See Also: ClassHelper.make(Class) See Also: ClassHelper.make(String) Parameters: cn - the ClassNode containing a possible primitive type |
isPrimitiveType | public static boolean isPrimitiveType(ClassNode cn)(Code) | | Test to determine if a ClasNode is a primitve type.
Note: this only works for ClassNodes created using a
predefined ClassNode
See Also: ClassHelper.make(Class) See Also: ClassHelper.make(String) Parameters: cn - the ClassNode containing a possible primitive type true if the ClassNode is a primitve type |
make | public static ClassNode[] make(Class[] classes)(Code) | | Creates an array of ClassNodes using an array of classes.
For each of the given classes a new ClassNode will be
created
See Also: ClassHelper.make(Class) Parameters: classes - an array of classes used to create the ClassNodes an array of ClassNodes |
make | public static ClassNode make(Class c)(Code) | | Creates a ClassNode using a given class.
A new ClassNode object is only created if the class
is not one of the predefined ones
Parameters: c - class used to created the ClassNode ClassNode instance created from the given class |
make | public static ClassNode make(String name)(Code) | | Creates 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
is null of of length 0 the dynamic type is returned
Parameters: name - of the class the ClassNode is representing |
makeWithoutCaching | public static ClassNode makeWithoutCaching(String name)(Code) | | Creates 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
references
See Also: ClassHelper.make(String) Parameters: name - of the class the ClassNode is representing |
|
|
|