public class ClassNodeUtils extends Object
Constructor and Description |
---|
ClassNodeUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addDeclaredMethodMapsFromSuperInterfaces(ClassNode cn,
Map<String,MethodNode> allInterfaceMethods) |
static void |
addInterfaceMethods(ClassNode cnode,
Map<String,MethodNode> methodsMap) |
static Map<String,MethodNode> |
getDeclaredMethodMapsFromInterfaces(ClassNode classNode) |
static String |
getPropNameForAccessor(String accessorName)
Returns the property name, e.g.
|
static PropertyNode |
getStaticProperty(ClassNode cNode,
String propName)
Detect whether a static property with the given name is within the class
or a super class.
|
static boolean |
hasPossibleStaticMethod(ClassNode cNode,
String name,
Expression arguments,
boolean trySpread)
Returns true if the given method has a possibly matching static method with the given name and arguments.
|
static boolean |
hasPossibleStaticProperty(ClassNode candidate,
String methodName)
Return true if we have a static accessor
|
static boolean |
hasStaticProperty(ClassNode cNode,
String propName) |
static boolean |
isInnerClass(ClassNode currentClass)
Detect whether a given ClassNode is a inner class (non-static).
|
static boolean |
isValidAccessorName(String accessorName)
Detect whether the given accessor name starts with "get", "set" or "is" followed by at least one character.
|
public static void addInterfaceMethods(ClassNode cnode, Map<String,MethodNode> methodsMap)
public static Map<String,MethodNode> getDeclaredMethodMapsFromInterfaces(ClassNode classNode)
public static void addDeclaredMethodMapsFromSuperInterfaces(ClassNode cn, Map<String,MethodNode> allInterfaceMethods)
public static boolean hasPossibleStaticMethod(ClassNode cNode, String name, Expression arguments, boolean trySpread)
cNode
- the ClassNode of interestname
- the name of the method of interestarguments
- the arguments to match againsttrySpread
- whether to try to account for SpreadExpressions within the argumentspublic static boolean hasPossibleStaticProperty(ClassNode candidate, String methodName)
public static String getPropNameForAccessor(String accessorName)
accessorName
- the accessor name of interest, e.g. getAgepublic static boolean isValidAccessorName(String accessorName)
accessorName
- the accessor name of interest, e.g. getAgepublic static PropertyNode getStaticProperty(ClassNode cNode, String propName)
cNode
- the ClassNode of interestpropName
- the property namepublic static boolean isInnerClass(ClassNode currentClass)
currentClass
- the ClassNode of interest