Tabnine Logo
ClassNode.getMethods
Code IndexAdd Tabnine to your IDE (free)

How to use
getMethods
method
in
org.codehaus.groovy.ast.ClassNode

Best Java code snippets using org.codehaus.groovy.ast.ClassNode.getMethods (Showing top 20 results out of 315)

origin: org.codehaus.groovy/groovy

@Override
public List<MethodNode> getMethods() {
  List<MethodNode> nodes = new LinkedList<MethodNode>();
  for (ClassNode delegate : delegates) {
    List<MethodNode> methods = delegate.getMethods();
    if (methods != null) nodes.addAll(methods);
  }
  return nodes;
}
origin: org.codehaus.groovy/groovy

public static List<MethodNode> getAllMethods(ClassNode type) {
  ClassNode node = type;
  List<MethodNode> result = new ArrayList<MethodNode>();
  while (node != null) {
    result.addAll(node.getMethods());
    node = node.getSuperClass();
  }
  return result;
}
origin: org.codehaus.groovy/groovy

private void checkMethodsForWeakerAccess(ClassNode cn) {
  for (MethodNode method : cn.getMethods()) {
    checkMethodForWeakerAccessPrivileges(method, cn);
  }
}
origin: org.codehaus.groovy/groovy

private boolean anyMethodSkip(final ClassNode node) {
  for (MethodNode methodNode : node.getMethods()) {
    if (isSkipMode(methodNode)) return true;
  }
  return false;
}
origin: org.codehaus.groovy/groovy

@Override
public List<MethodNode> getMethods() {
  lazyInitMembers();
  return super.getMethods();
}
origin: spockframework/spock

public static void deleteMethod(ClassNode clazz, MethodNode method) {
 // as of 1.8.6, this is the best possible implementation
 clazz.getMethods().remove(method);
 clazz.getDeclaredMethods(method.getName()).remove(method);
}
origin: org.codehaus.groovy/groovy

  public int compare(final ClassNode o1, final ClassNode o2) {
    int interfaceCountForO1 = o1.getInterfaces().length;
    int interfaceCountForO2 = o2.getInterfaces().length;
    if (interfaceCountForO1 > interfaceCountForO2) return -1;
    if (interfaceCountForO1 < interfaceCountForO2) return 1;
    int methodCountForO1 = o1.getMethods().size();
    int methodCountForO2 = o2.getMethods().size();
    if (methodCountForO1 > methodCountForO2) return -1;
    if (methodCountForO1 < methodCountForO2) return 1;
    return o1.getName().compareTo(o2.getName());
  }
};
origin: org.codehaus.groovy/groovy

private static String scriptBodySignatureWithoutReturnType(ClassNode cn) {
  for (MethodNode mn : cn.getMethods()) {
    if (mn.isScriptBody()) return methodDescriptorWithoutReturnType(mn);
  }
  return null;
}
origin: org.codehaus.groovy/groovy

/**
 * @return the list of methods associated with this ClassNode
 */
public List<MethodNode> getMethods() {
  if (redirect!=null) return redirect().getMethods();
  lazyClassInit();
  return methodsList;
}
origin: org.codehaus.groovy/groovy

public Map<String, MethodNode> getDeclaredMethodsMap() {
  Map<String, MethodNode> result = ClassNodeUtils.getDeclaredMethodsFromSuper(this);
  ClassNodeUtils.addDeclaredMethodsFromInterfaces(this, result);
  // And add in the methods implemented in this class.
  for (MethodNode method : getMethods()) {
    String sig = method.getTypeDescriptor();
    result.put(sig, method);
  }
  return result;
}
origin: org.codehaus.groovy/groovy

private static List<MethodNode> filterMethods(ClassNode owner) {
  List<MethodNode> result = new LinkedList<MethodNode>();
  List<MethodNode> methods = owner.getMethods();
  for (MethodNode method : methods) {
    if (method.getDeclaringClass() == owner && !method.isSynthetic()) {
      if ("main".equals(method.getName()) || "run".equals(method.getName()) && owner.isScriptBody()) continue;
      result.add(method);
    }
  }
  return result;
}
origin: org.codehaus.groovy/groovy

protected void collectAllInterfaceMethodsByName(final ClassNode receiver, final String name, final List<MethodNode> methods) {
  ClassNode cNode = receiver;
  while (cNode != null) {
    ClassNode[] interfaces = cNode.getInterfaces();
    if (interfaces != null && interfaces.length > 0) {
      for (ClassNode node : interfaces) {
        List<MethodNode> intfMethods = node.getMethods(name);
        methods.addAll(intfMethods);
        collectAllInterfaceMethodsByName(node, name, methods);
      }
    }
    cNode = cNode.getSuperClass();
  }
}
origin: org.codehaus.groovy/groovy

private static void checkForAbstractMethods(ClassNode enumClass) {
  List<MethodNode> methods = enumClass.getMethods();
  for (MethodNode m : methods) {
    if (m.isAbstract()) {
      // make the class abstract also see Effective Java p.152
      enumClass.setModifiers(enumClass.getModifiers() | Opcodes.ACC_ABSTRACT);
      break;
    }
  }
}
origin: spockframework/spock

 private static boolean checkIsConditionBlock(MethodCallExpression methodCallExpr) {
  ClassNode targetType = methodCallExpr.getObjectExpression().getType();
  String methodName = methodCallExpr.getMethodAsString();

  List<MethodNode> methods = targetType.getMethods(methodName);
  for (MethodNode method : methods) {
   for (AnnotationNode annotation : method.getAnnotations()) {
    if (annotation.getClassNode().getName().equals(ConditionBlock.class.getName())) return true;
   }
  }

  return false;
 }
}
origin: org.codehaus.groovy/groovy

private void checkMethodsForOverridingFinal(ClassNode cn) {
  for (MethodNode method : cn.getMethods()) {
    Parameter[] params = method.getParameters();
    for (MethodNode superMethod : cn.getSuperClass().getMethods(method.getName())) {
      Parameter[] superParams = superMethod.getParameters();
      if (!hasEqualParameterTypes(params, superParams)) continue;
      if (!superMethod.isFinal()) break;
      addInvalidUseOfFinalError(method, params, superMethod.getDeclaringClass());
      return;
    }
  }
}
origin: org.codehaus.groovy/groovy

public void createMopMethods() {
  ClassNode classNode = controller.getClassNode();
  if (classNode.declaresInterface(ClassHelper.GENERATED_CLOSURE_Type)) {
    return;
  }
  Set<MopKey> currentClassSignatures = buildCurrentClassSignatureSet(classNode.getMethods());
  visitMopMethodList(classNode.getMethods(), true, Collections.EMPTY_SET, Collections.EMPTY_LIST);
  visitMopMethodList(classNode.getSuperClass().getAllDeclaredMethods(), false, currentClassSignatures, controller.getSuperMethodNames());
}
origin: org.codehaus.groovy/groovy

private void createListenerSetter(ClassNode classNode, PropertyNode propertyNode) {
  String setterName = "set" + MetaClassHelper.capitalize(propertyNode.getName());
  if (classNode.getMethods(setterName).isEmpty()) {
    Statement setterBlock = createBindableStatement(propertyNode, fieldX(propertyNode.getField()));
    // create method void <setter>(<type> fieldName)
    createSetterMethod(classNode, propertyNode, setterName, setterBlock);
  } else {
    wrapSetterMethod(classNode, propertyNode.getName());
  }
}
origin: org.codehaus.groovy/groovy

private void checkRepetitiveMethod(MethodNode node) {
  if (isConstructor(node)) return;
  for (MethodNode method : currentClass.getMethods(node.getName())) {
    if (method == node) continue;
    if (!method.getDeclaringClass().equals(node.getDeclaringClass())) continue;
    Parameter[] p1 = node.getParameters();
    Parameter[] p2 = method.getParameters();
    if (p1.length != p2.length) continue;
    addErrorIfParamsAndReturnTypeEqual(p2, p1, node, method);
  }
}
origin: org.codehaus.groovy/groovy

private void checkInterfaceMethodVisibility(ClassNode node) {
  if (!node.isInterface()) return;
  for (MethodNode method : node.getMethods()) {
    if (method.isPrivate()) {
      addError("Method '" + method.getName() + "' is private but should be public in " + getDescription(currentClass) + ".", method);
    } else if (method.isProtected()) {
      addError("Method '" + method.getName() + "' is protected but should be public in " + getDescription(currentClass) + ".", method);
    }
  }
}
origin: org.codehaus.groovy/groovy

private void checkMethodForWeakerAccessPrivileges(MethodNode mn, ClassNode cn) {
  if (mn.isPublic()) return;
  Parameter[] params = mn.getParameters();
  for (MethodNode superMethod : cn.getSuperClass().getMethods(mn.getName())) {
    Parameter[] superParams = superMethod.getParameters();
    if (!hasEqualParameterTypes(params, superParams)) continue;
    if ((mn.isPrivate() && !superMethod.isPrivate()) ||
        (mn.isProtected() && superMethod.isPublic())) {
      addWeakerAccessError(cn, mn, params, superMethod);
      return;
    }
  }
}
org.codehaus.groovy.astClassNodegetMethods

Javadoc

Returns a list containing MethodNode objects for each method in the class represented by this ClassNode

Popular methods of ClassNode

  • getName
  • <init>
    Constructor used by makeArray() if no real class is available
  • getSuperClass
  • equals
  • addMethod
  • getAnnotations
  • addField
  • getFields
    Returns a list containing FieldNode objects for each field in the class represented by this ClassNod
  • getPlainNodeReference
  • getField
    Finds a field matching the given name in this class or a parent class.
  • getMethod
    Finds a method matching the given name and parameters in this class or any parent class.
  • isInterface
  • getMethod,
  • isInterface,
  • getNameWithoutPackage,
  • isScript,
  • getDeclaredMethod,
  • getGenericsTypes,
  • getDeclaredConstructors,
  • getModifiers,
  • getTypeClass

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • getSystemService (Context)
  • startActivity (Activity)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JList (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now