Codota Logo
ClassNode.getMethods
Code IndexAdd Codota 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)

  • Common ways to obtain ClassNode
private void myMethod () {
ClassNode c =
  • Codota IconExpression expression;expression.getType()
  • Codota IconMethodNode methodNode;methodNode.getReturnType()
  • Codota IconString name;ClassHelper.make(name)
  • Smart code suggestions by Codota
}
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

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • JLabel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now