public abstract class Traits
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
| static interface  | Traits.ImplementedInternal annotation used to indicate which methods in a trait interface have a
 default implementation. | 
| static interface  | Traits.TraitBridgeInternal annotation used to indicate that a method is a bridge method to a trait
 default implementation. | 
| Modifier and Type | Field and Description | 
|---|---|
| static ClassNode | GENERATED_PROXY_CLASSNODE | 
| static ClassNode | IMPLEMENTED_CLASSNODE | 
| static ClassNode | SELFTYPE_CLASSNODE | 
| static java.lang.String | STATIC_THIS_OBJECT | 
| static java.lang.String | THIS_OBJECT | 
| static java.lang.Class<Trait> | TRAIT_CLASS | 
| static ClassNode | TRAIT_CLASSNODE | 
| static ClassNode | TRAITBRIDGE_CLASSNODE | 
| Constructor and Description | 
|---|
| Traits() | 
| Modifier and Type | Method and Description | 
|---|---|
| static java.util.LinkedHashSet<ClassNode> | collectAllInterfacesReverseOrder(ClassNode cNode,
                                java.util.LinkedHashSet<ClassNode> interfaces)Collects all interfaces of a class node, but reverses the order of the declaration of direct interfaces
 of this class node. | 
| static java.util.LinkedHashSet<ClassNode> | collectSelfTypes(ClassNode receiver,
                java.util.LinkedHashSet<ClassNode> selfTypes)Collects all the self types that a type should extend or implement, given
 the traits is implements. | 
| static java.util.LinkedHashSet<ClassNode> | collectSelfTypes(ClassNode receiver,
                java.util.LinkedHashSet<ClassNode> selfTypes,
                boolean checkInterfaces,
                boolean checkSuper)Collects all the self types that a type should extend or implement, given
 the traits is implements. | 
| static java.lang.String[] | decomposeSuperCallName(java.lang.String origName)Returns the name of a method without the super trait specific prefix. | 
| static ClassNode | findFieldHelper(ClassNode trait) | 
| static ClassNode | findHelper(ClassNode trait) | 
| static <T> T | getAsType(java.lang.Object self,
         java.lang.Class<T> clazz)Converts a class implementing some trait into a target class. | 
| static java.lang.reflect.Method | getBridgeMethodTarget(java.lang.reflect.Method someMethod)Reflection API to find the method corresponding to the default implementation of a trait, given a bridge method. | 
| static boolean | hasDefaultImplementation(java.lang.reflect.Method method)Indicates whether a method in a trait interface has a default implementation. | 
| static boolean | hasDefaultImplementation(MethodNode method)Indicates whether a method in a trait interface has a default implementation. | 
| static boolean | isAnnotatedWithTrait(ClassNode cNode)Returns true if the specified class node is annotated with the  Traitinterface. | 
| static boolean | isBridgeMethod(java.lang.reflect.Method someMethod)Reflection API to indicate whether some method is a bridge method to the default implementation
 of a trait. | 
| static boolean | isTrait(java.lang.Class<?> clazz)Returns true if the specified class is a trait. | 
| static boolean | isTrait(ClassNode cNode)Returns true if the specified class node is a trait. | 
public static final ClassNode IMPLEMENTED_CLASSNODE
public static final ClassNode TRAITBRIDGE_CLASSNODE
public static final java.lang.Class<Trait> TRAIT_CLASS
public static final ClassNode TRAIT_CLASSNODE
public static final ClassNode GENERATED_PROXY_CLASSNODE
public static final ClassNode SELFTYPE_CLASSNODE
public static final java.lang.String THIS_OBJECT
public static final java.lang.String STATIC_THIS_OBJECT
public static boolean isTrait(ClassNode cNode)
cNode - a class node to testpublic static boolean isTrait(java.lang.Class<?> clazz)
clazz - a class to testpublic static boolean isAnnotatedWithTrait(ClassNode cNode)
Trait interface.cNode - a class nodeTrait interface.public static boolean hasDefaultImplementation(MethodNode method)
method - a method nodepublic static boolean hasDefaultImplementation(java.lang.reflect.Method method)
method - a method nodepublic static boolean isBridgeMethod(java.lang.reflect.Method someMethod)
someMethod - a method nodepublic static java.lang.reflect.Method getBridgeMethodTarget(java.lang.reflect.Method someMethod)
someMethod - a method nodepublic static <T> T getAsType(java.lang.Object self,
                              java.lang.Class<T> clazz)
DefaultGroovyMethods.asType(java.lang.Object, Class)self - an object to be coerced to some classclazz - the class to be coerced topublic static java.lang.String[] decomposeSuperCallName(java.lang.String origName)
origName - the name of a methodpublic static java.util.LinkedHashSet<ClassNode> collectAllInterfacesReverseOrder(ClassNode cNode, java.util.LinkedHashSet<ClassNode> interfaces)
cNode - a class nodeinterfaces - ordered set of interfacespublic static java.util.LinkedHashSet<ClassNode> collectSelfTypes(ClassNode receiver, java.util.LinkedHashSet<ClassNode> selfTypes)
receiver - a class node that may implement a traitselfTypes - a collection where the list of self types will be writtenpublic static java.util.LinkedHashSet<ClassNode> collectSelfTypes(ClassNode receiver, java.util.LinkedHashSet<ClassNode> selfTypes, boolean checkInterfaces, boolean checkSuper)
receiver - a class node that may implement a traitselfTypes - a collection where the list of self types will be writtencheckInterfaces - should the interfaces that the node implements be collected toocheckSuper - should we collect from the superclass too