Codota Logo
ClassNode.declaresInterface
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using org.codehaus.groovy.ast.ClassNode.declaresInterface (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 boolean declaresInterface(final ClassNode classNode) {
  for (ClassNode delegate : delegates) {
    if (delegate.declaresInterface(classNode)) return true;
  }
  return false;
}
origin: org.codehaus.groovy/groovy-jdk14

/**
 * @param classNode the class node for the interface
 * @return true if this class declares that it implements the given interface
 * or if one of its interfaces extends directly or indirectly the interface
 */
public boolean declaresInterface(ClassNode classNode) {
  ClassNode[] interfaces = redirect().getInterfaces();
  if (declaresInterfaceDirect(interfaces, classNode)) return true;
  List superInterfaces = Arrays.asList(interfaces);
  while (superInterfaces.size() > 0) {
    List keep = new ArrayList();
    for (int i = 0; i < superInterfaces.size(); i++) {
      ClassNode cn = (ClassNode) superInterfaces.get(i);
      if (cn.declaresInterface(classNode)) return true;
      keep.addAll(Arrays.asList(cn.getInterfaces()));
    }
    superInterfaces = keep;
  }
  return false;
}
origin: org.codehaus.groovy/groovy

/**
 * @param classNode the class node for the interface
 * @return true if this class or any base class implements the given interface
 */
public boolean implementsInterface(ClassNode classNode) {
  ClassNode node = redirect();
  do {
    if (node.declaresInterface(classNode)) {
      return true;
    }
    node = node.getSuperClass();
  }
  while (node != null);
  return false;
}
origin: org.kohsuke.droovy/groovy

/**
 * @param classNode the class node for the interface
 * @return true if this class declares that it implements the given interface
 * or if one of its interfaces extends directly or indirectly the interface
 */
public boolean declaresInterface(ClassNode classNode) {
  ClassNode[] interfaces = redirect().getInterfaces();
  if (declaresInterfaceDirect(interfaces, classNode)) return true;
  List superInterfaces = Arrays.asList(interfaces);
  while (superInterfaces.size() > 0) {
    List keep = new ArrayList();
    for (int i = 0; i < superInterfaces.size(); i++) {
      ClassNode cn = (ClassNode) superInterfaces.get(i);
      if (cn.declaresInterface(classNode)) return true;
      keep.addAll(Arrays.asList(cn.getInterfaces()));
    }
    superInterfaces = keep;
  }
  return false;
}
origin: org.codehaus.groovy/groovy

/**
 * @param classNode the class node for the interface
 * @return true if this class declares that it implements the given interface
 * or if one of its interfaces extends directly or indirectly the interface
 *
 * NOTE: Doesn't consider an interface to implement itself.
 * I think this is intended to be called on ClassNodes representing
 * classes, not interfaces.
 * 
 */
public boolean declaresInterface(ClassNode classNode) {
  ClassNode[] interfaces = redirect().getInterfaces();
  for (ClassNode cn : interfaces) {
    if (cn.equals(classNode)) return true;
  }
  for (ClassNode cn : interfaces) {
    if (cn.declaresInterface(classNode)) return true;
  }
  return false;
}
origin: org.codehaus.groovy/groovy-all-minimal

/**
 * @param classNode the class node for the interface
 * @return true if this class declares that it implements the given interface
 * or if one of its interfaces extends directly or indirectly the interface
 */
public boolean declaresInterface(ClassNode classNode) {
  ClassNode[] interfaces = redirect().getInterfaces();
  if (declaresInterfaceDirect(interfaces, classNode)) return true;
  List superInterfaces = Arrays.asList(interfaces);
  while (superInterfaces.size() > 0) {
    List keep = new ArrayList();
    for (int i = 0; i < superInterfaces.size(); i++) {
      ClassNode cn = (ClassNode) superInterfaces.get(i);
      if (cn.declaresInterface(classNode)) return true;
      keep.addAll(Arrays.asList(cn.getInterfaces()));
    }
    superInterfaces = keep;
  }
  return false;
}
origin: org.codehaus.groovy/groovy

private MethodNode getCompatibleMethod(ClassNode current, String getAt, ClassNode aType) {
  // TODO this really should find "best" match or find all matches and complain about ambiguity if more than one
  // TODO handle getAt with more than one parameter
  // TODO handle default getAt methods on Java 8 interfaces
  for (MethodNode methodNode : current.getDeclaredMethods("getAt")) {
    if (methodNode.getParameters().length == 1) {
      ClassNode paramType = methodNode.getParameters()[0].getType();
      if (aType.isDerivedFrom(paramType) || aType.declaresInterface(paramType)) {
        return methodNode;
      }
    }
  }
  return null;
}
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

public boolean addGeneratedClosureConstructorCall(ConstructorCallExpression call) {
  ClassNode classNode = controller.getClassNode();
  if (!classNode.declaresInterface(ClassHelper.GENERATED_CLOSURE_Type)) return false;
  AsmClassGenerator acg = controller.getAcg();
  OperandStack operandStack = controller.getOperandStack();
  
  MethodVisitor mv = controller.getMethodVisitor();
  mv.visitVarInsn(ALOAD, 0);
  ClassNode callNode = classNode.getSuperClass();
  TupleExpression arguments = (TupleExpression) call.getArguments();
  if (arguments.getExpressions().size()!=2) throw new GroovyBugError("expected 2 arguments for closure constructor super call, but got"+arguments.getExpressions().size());
  arguments.getExpression(0).visit(acg);
  operandStack.box();
  arguments.getExpression(1).visit(acg);
  operandStack.box();
  //TODO: replace with normal String, p not needed
  Parameter p = new Parameter(ClassHelper.OBJECT_TYPE,"_p");
  String descriptor = BytecodeHelper.getMethodDescriptor(ClassHelper.VOID_TYPE, new Parameter[]{p,p});
  mv.visitMethodInsn(INVOKESPECIAL, BytecodeHelper.getClassInternalName(callNode), "<init>", descriptor, false);
  operandStack.remove(2);
  return true;
}
origin: org.codehaus.groovy/groovy

    staticInitCall
)), false);
if (fieldHelperClassNode != null && !cNode.declaresInterface(fieldHelperClassNode)) {
origin: org.codehaus.griffon/griffon-groovy-compile

private boolean isTypeCompatible(ClassNode base, ClassNode target) {
  return target.equals(base) || target.implementsInterface(base) || target.declaresInterface(base);
}
origin: org.codehaus.groovy/groovy-all-minimal

/**
 * @param classNode the class node for the interface
 * @return true if this class or any base class implements the given interface
 */
public boolean implementsInterface(ClassNode classNode) {
  ClassNode node = redirect();
  do {
    if (node.declaresInterface(classNode)) {
      return true;
    }
    node = node.getSuperClass();
  }
  while (node != null);
  return false;
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

/**
 * @param classNode the class node for the interface
 * @return true if this class or any base class implements the given interface
 */
public boolean implementsInterface(ClassNode classNode) {
  ClassNode node = redirect();
  do {
    if (node.declaresInterface(classNode)) {
      return true;
    }
    node = node.getSuperClass();
  }
  while (node != null);
  return false;
}
origin: org.codehaus.groovy/groovy-jdk14

/**
 * @param classNode the class node for the interface
 * @return true if this class or any base class implements the given interface
 */
public boolean implementsInterface(ClassNode classNode) {
  ClassNode node = redirect();
  do {
    if (node.declaresInterface(classNode)) {
      return true;
    }
    node = node.getSuperClass();
  }
  while (node != null);
  return false;
}
origin: org.kohsuke.droovy/groovy

/**
 * @param classNode the class node for the interface
 * @return true if this class or any base class implements the given interface
 */
public boolean implementsInterface(ClassNode classNode) {
  ClassNode node = redirect();
  do {
    if (node.declaresInterface(classNode)) {
      return true;
    }
    node = node.getSuperClass();
  }
  while (node != null);
  return false;
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

/**
 * @param classNode the class node for the interface
 * @return true if this class declares that it implements the given interface
 * or if one of its interfaces extends directly or indirectly the interface
 *
 * NOTE: Doesn't consider an interface to implement itself.
 * I think this is intended to be called on ClassNodes representing
 * classes, not interfaces.
 * 
 */
public boolean declaresInterface(ClassNode classNode) {
  ClassNode[] interfaces = redirect().getInterfaces();
  for (ClassNode cn : interfaces) {
    if (cn.equals(classNode)) return true;
  }
  for (ClassNode cn : interfaces) {
    if (cn.declaresInterface(classNode)) return true;
  }
  return false;
}
origin: disney/groovity

  public void visitMethod(MethodNode node){
    if(isTag && !node.isStatic() && node.getName().equals(TAG) && node.getParameters().length==2 && node.getReturnType().equals(ClassHelper.OBJECT_TYPE)){
      ClassNode taggableNode = new ClassNode(Taggable.class);
      if(!classNode.declaresInterface(taggableNode)){
        classNode.addInterface(taggableNode);
      }
    }
    super.visitMethod(node);
  }
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public void createMopMethods() {
  ClassNode classNode = controller.getClassNode();
  if (classNode.declaresInterface(ClassHelper.GENERATED_CLOSURE_Type)) {
    return;
  }
  visitMopMethodList(classNode.getMethods(), true);
  visitMopMethodList(classNode.getSuperClass().getAllDeclaredMethods(), false);
}

origin: com.disney.groovity/groovity-core

  public void visitMethod(MethodNode node){
    if(isTag && !node.isStatic() && node.getName().equals(TAG) && node.getParameters().length==2 && node.getReturnType().equals(ClassHelper.OBJECT_TYPE)){
      ClassNode taggableNode = new ClassNode(Taggable.class);
      if(!classNode.declaresInterface(taggableNode)){
        classNode.addInterface(taggableNode);
      }
    }
    super.visitMethod(node);
  }
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public boolean addGeneratedClosureConstructorCall(ConstructorCallExpression call) {
  ClassNode classNode = controller.getClassNode();
  if (!classNode.declaresInterface(ClassHelper.GENERATED_CLOSURE_Type)) return false;
  AsmClassGenerator acg = controller.getAcg();
  OperandStack operandStack = controller.getOperandStack();
  
  MethodVisitor mv = controller.getMethodVisitor();
  mv.visitVarInsn(ALOAD, 0);
  ClassNode callNode = classNode.getSuperClass();
  TupleExpression arguments = (TupleExpression) call.getArguments();
  if (arguments.getExpressions().size()!=2) throw new GroovyBugError("expected 2 arguments for closure constructor super call, but got"+arguments.getExpressions().size());
  arguments.getExpression(0).visit(acg);
  operandStack.box();
  arguments.getExpression(1).visit(acg);
  operandStack.box();
  //TODO: replace with normal String, p not needed
  Parameter p = new Parameter(ClassHelper.OBJECT_TYPE,"_p");
  String descriptor = BytecodeHelper.getMethodDescriptor(ClassHelper.VOID_TYPE, new Parameter[]{p,p});
  mv.visitMethodInsn(INVOKESPECIAL, BytecodeHelper.getClassInternalName(callNode), "<init>", descriptor);
  operandStack.remove(2);
  return true;
}
org.codehaus.groovy.astClassNodedeclaresInterface

Popular methods of ClassNode

  • getName
  • getMethods
    This methods creates a list of all methods with this name of the current class and of all super clas
  • <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.
  • getField,
  • getMethod,
  • isInterface,
  • getNameWithoutPackage,
  • isScript,
  • getDeclaredMethod,
  • getGenericsTypes,
  • getDeclaredConstructors,
  • getModifiers,
  • getTypeClass

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • JFileChooser (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
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