| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static void | addDeclaredMethodsFromAllInterfaces(ClassNode
The ClassNode cNode, Map<String, MethodNode> A map of existing methods to alter methodsMap)Adds methods from interfaces and parent interfaces. |
| public static void | addDeclaredMethodsFromInterfaces(ClassNode
The ClassNode cNode, Map<String, MethodNode> A map of existing methods to alter methodsMap)Adds methods from all interfaces. |
| public static ConstructorNode | addGeneratedConstructor(ClassNode classNode, int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code)
Add a method that is marked as |
| public static void | addGeneratedConstructor(ClassNode classNode, ConstructorNode consNode)
Add a method that is marked as |
| public static void | addGeneratedInnerClass(ClassNode cNode, ClassNode inner)
Add an inner class that is marked as |
| public static MethodNode | |
| public static void | |
| public static void | addGeneratedMethod(final ClassNode cNode, final MethodNode mNode, final boolean skipChecks)
Add a method and mark it as |
| public static String | Returns: a human readable version of the type name (java.lang.String[] for example)the type to format cNode)Formats a type name into a human readable version. |
| public static Map | Returns: A map of methodsThe ClassNode cNode)Gets methods from all interfaces. |
| public static Map | Returns: A map of methodsThe ClassNode cNode)Add methods from the super class. |
| public static FieldNode | |
| public static String | Returns: the property name, e.g. age, or original if not a valid property accessor namethe accessor name of interest, e.g. getAge accessorName)Returns the property name, e.g. age, given an accessor name, e.g. getAge. |
| public static PropertyNode | Returns: the static property if found or else nullthe ClassNode of interest cNode, String the property name propName)Detect whether a static property with the given name is within the class or a super class. |
| public static boolean | Returns: true if an explicit (non-generated) constructor was foundif non null, add an error if an explicit constructor is found xform, ClassNode the type of the containing class cNode)Determine if an explicit (non-generated) constructor is in the class. |
| public static boolean | |
| public static boolean | Returns: true if a matching method was found.the ClassNode of interest cNode, final String the name of the method of interest name, final Expression the arguments to match against arguments, final boolean whether to try to account for SpreadExpressions within the arguments trySpread)Returns true if the given method has a possibly matching static method with the given name and arguments. |
| public static boolean | hasPossibleStaticProperty(ClassNode cNode, String methodName)
Return true if we have a static accessor |
| public static boolean | |
| public static boolean | Returns: true if the given node is a (non-static) inner class, else falsethe ClassNode of interest cNode)Detect whether a given ClassNode is an inner class (non-static). |
| public static boolean | |
| public static boolean | Returns: true if a valid prefix is foundthe accessor name of interest, e.g. getAge accessorName)Detect whether the given accessor name starts with "get", "set" or "is" followed by at least one character. |
| public static boolean | Returns: true if both given nodes have the same package namea ClassNode first, ClassNode a ClassNode second)Determine if the given ClassNode values have the same package name. |
| ClassNodeUtils | back to summary |
|---|---|
| private ClassNodeUtils() | |
| addDeclaredMethodsFromAllInterfaces | back to summary |
|---|---|
| public static void addDeclaredMethodsFromAllInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) Adds methods from interfaces and parent interfaces. Existing entries in the methods map take precedence. Methods from interfaces visited early take precedence over later ones.
| |
| addDeclaredMethodsFromInterfaces | back to summary |
|---|---|
| public static void addDeclaredMethodsFromInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) Adds methods from all interfaces. Existing entries in the methods map take precedence. Methods from interfaces visited early take precedence over later ones.
| |
| addGeneratedConstructor | back to summary |
|---|---|
| public static ConstructorNode addGeneratedConstructor(ClassNode classNode, int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code) Add a method that is marked as | |
| addGeneratedConstructor | back to summary |
|---|---|
| public static void addGeneratedConstructor(ClassNode classNode, ConstructorNode consNode) Add a method that is marked as | |
| addGeneratedInnerClass | back to summary |
|---|---|
| public static void addGeneratedInnerClass(ClassNode cNode, ClassNode inner) Add an inner class that is marked as | |
| addGeneratedMethod | back to summary |
|---|---|
| public static MethodNode addGeneratedMethod(ClassNode cNode, String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) Return an existing method if one exists or else create a new method and mark it as | |
| addGeneratedMethod | back to summary |
|---|---|
| public static void addGeneratedMethod(ClassNode cNode, MethodNode mNode) Add a method and mark it as
| |
| addGeneratedMethod | back to summary |
|---|---|
| public static void addGeneratedMethod(final ClassNode cNode, final MethodNode mNode, final boolean skipChecks) Add a method and mark it as
| |
| formatTypeName | back to summary |
|---|---|
| public static String formatTypeName(ClassNode cNode) Formats a type name into a human readable version. For arrays, appends "[]" to the formatted type name of the component. For unit class nodes, uses the class node name. | |
| getDeclaredMethodsFromInterfaces | back to summary |
|---|---|
| public static Map Gets methods from all interfaces. Methods from interfaces visited early take precedence over later ones.
| |
| getDeclaredMethodsFromSuper | back to summary |
|---|---|
| public static Map Add methods from the super class.
| |
| getField | back to summary |
|---|---|
| public static FieldNode getField(ClassNode classNode, String fieldName) Return the (potentially inherited) field of the classnode. | |
| getPropNameForAccessor | back to summary |
|---|---|
| public static String getPropNameForAccessor(String accessorName) Returns the property name, e.g. age, given an accessor name, e.g. getAge. Returns the original if a valid prefix cannot be removed. | |
| getStaticProperty | back to summary |
|---|---|
| public static PropertyNode getStaticProperty(ClassNode cNode, String propName) Detect whether a static property with the given name is within the class or a super class.
| |
| hasExplicitConstructor | back to summary |
|---|---|
| public static boolean hasExplicitConstructor(AbstractASTTransformation xform, ClassNode cNode) Determine if an explicit (non-generated) constructor is in the class.
| |
| hasNoArgConstructor | back to summary |
|---|---|
| public static boolean hasNoArgConstructor(ClassNode cNode) | |
| hasPossibleStaticMethod | back to summary |
|---|---|
| public static boolean hasPossibleStaticMethod(final ClassNode cNode, final String name, final Expression arguments, final boolean trySpread) Returns true if the given method has a possibly matching static method with the given name and arguments. Handles default arguments and optionally spread expressions.
| |
| hasPossibleStaticProperty | back to summary |
|---|---|
| public static boolean hasPossibleStaticProperty(ClassNode cNode, String methodName) Return true if we have a static accessor | |
| hasStaticProperty | back to summary |
|---|---|
| public static boolean hasStaticProperty(ClassNode cNode, String propName) | |
| isInnerClass | back to summary |
|---|---|
| public static boolean isInnerClass(final ClassNode cNode) Detect whether a given ClassNode is an inner class (non-static).
| |
| isSubtype | back to summary |
|---|---|
| public static boolean isSubtype(ClassNode maybeSuperclassOrInterface, ClassNode candidateChild) | |
| isValidAccessorName | back to summary |
|---|---|
| public static boolean isValidAccessorName(String accessorName) Detect whether the given accessor name starts with "get", "set" or "is" followed by at least one character.
| |
| samePackageName | back to summary |
|---|---|
| public static boolean samePackageName(ClassNode first, ClassNode second) Determine if the given ClassNode values have the same package name.
| |