congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ClassNode.declaresInterface
Code IndexAdd Tabnine 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)

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

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Github Copilot alternatives
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