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

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

Best Java code snippets using org.codehaus.groovy.ast.ClassNode.equals (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: spockframework/spock

private int computeDepth(ClassNode node) {
 if (node.equals(ClassHelper.OBJECT_TYPE) || node.equals(nodeCache.Specification)) return -1;
 return computeDepth(node.getSuperClass()) + 1;
}
origin: org.codehaus.groovy/groovy

private boolean directlyImplementsTrait(ClassNode trait) {
  ClassNode[] interfaces = currentClass.getInterfaces();
  if (interfaces==null) {
    return currentClass.getSuperClass().equals(trait);
  }
  for (ClassNode node : interfaces) {
    if (node.equals(trait)) {
      return true;
    }
  }
  return currentClass.getSuperClass().equals(trait);
}
origin: org.codehaus.groovy/groovy

private static void visitInsnByType(ClassNode top, MethodVisitor mv, int iInsn, int lInsn, int fInsn, int dInsn) {
  if (WideningCategories.isIntCategory(top) || char_TYPE.equals(top)) {
    mv.visitInsn(iInsn);
  } else if (long_TYPE.equals(top)) {
    mv.visitInsn(lInsn);
  } else if (float_TYPE.equals(top)) {
    mv.visitInsn(fInsn);
  } else if (double_TYPE.equals(top)) {
    mv.visitInsn(dInsn);
  }
}
origin: org.codehaus.groovy/groovy

public List<ClassNode> getOuterClasses() {
  if (!(this instanceof InnerClassNode)) {
    return Collections.emptyList();
  }
  List<ClassNode> result = new LinkedList<>();
  ClassNode outestClass = ((InnerClassNode) this).getOuterMostClass();
  ClassNode cn = this;
  do {
    result.add(cn = cn.getOuterClass());
  } while (!cn.equals(outestClass));
  return result;
}
origin: org.codehaus.groovy/groovy

private static Character tryCharConstant(final Expression expr) {
  if (expr instanceof ConstantExpression) {
    ConstantExpression ce = (ConstantExpression) expr;
    if (ClassHelper.STRING_TYPE.equals(ce.getType())) {
      String val = (String) ce.getValue();
      if (val!=null && val.length()==1) {
        return val.charAt(0);
      }
    }
  }
  return null;
}
origin: org.codehaus.groovy/groovy

/**
 * Return true if we have a static accessor
 */
public static boolean hasPossibleStaticProperty(ClassNode cNode, String methodName) {
  // assume explicit static method call checked first so we can assume a simple check here
  if (!methodName.startsWith("get") && !methodName.startsWith("is")) {
    return false;
  }
  String propName = getPropNameForAccessor(methodName);
  PropertyNode pNode = getStaticProperty(cNode, propName);
  return pNode != null && (methodName.startsWith("get") || boolean_TYPE.equals(pNode.getType()));
}
origin: org.codehaus.groovy/groovy

public static boolean equalParameterTypes(Parameter[] p1, Parameter[] p2) {
  if (p1.length != p2.length) return false;
  for (int i = 0; i < p1.length; i++) {
    if (!p1[i].getType().equals(p2[i].getType())) return false;
  }
  return true;
}
origin: org.codehaus.groovy/groovy

public boolean equals(Object o) {
  if (redirect!=null) return redirect().equals(o);
  if (!(o instanceof ClassNode)) return false;
  ClassNode cn = (ClassNode) o;
  return (cn.getText().equals(getText()));
}
origin: org.codehaus.groovy/groovy

  private static boolean isCustomScriptBodyMethod(MethodNode node) {
    return node != null
      && !(node.getDeclaringClass().equals(ClassHelper.SCRIPT_TYPE)
        && "run".equals(node.getName())
        && node.getParameters().length == 0);
  }
}
origin: remkop/picocli

  private boolean isCustomScriptBodyMethod(MethodNode node) {
    return node != null
        && !(node.getDeclaringClass().equals(ClassHelper.SCRIPT_TYPE)
        && "run".equals(node.getName())
        && node.getParameters().length == 0);
  }
}
origin: org.codehaus.groovy/groovy

public void visit(ASTNode[] nodes, SourceUnit source) {
  init(nodes, source);
  AnnotatedNode parent = (AnnotatedNode) nodes[1];
  AnnotationNode node = (AnnotationNode) nodes[0];
  if (!MY_TYPE.equals(node.getClassNode())) return;
  if (parent instanceof ClassNode) {
    processClass((ClassNode) parent, node);
  }
}
origin: org.codehaus.groovy/groovy

public void checkReturnType(ClassNode attrType, ASTNode node) {
  if (attrType.isArray()) {
    checkReturnType(attrType.getComponentType(), node);
  } else if (ClassHelper.isPrimitiveType(attrType)) {
  } else if (ClassHelper.STRING_TYPE.equals(attrType)) {
  } else if (ClassHelper.CLASS_Type.equals(attrType)) {
  } else if (attrType.isDerivedFrom(ClassHelper.Enum_Type)) {
  } else if (isValidAnnotationClass(attrType)) {
  } else {
    addError("Unexpected return type " + attrType.getName(), node);
  }
}
origin: org.codehaus.groovy/groovy

private static FieldNode tryGetFieldNode(final ClassNode weavedType, final String fieldName) {
  FieldNode fn = weavedType.getDeclaredField(fieldName);
  if (fn == null && ClassHelper.CLASS_Type.equals(weavedType)) {
    GenericsType[] genericsTypes = weavedType.getGenericsTypes();
    if (genericsTypes != null && genericsTypes.length == 1) {
      // for static properties
      fn = genericsTypes[0].getType().getDeclaredField(fieldName);
    }
  }
  return fn;
}
origin: org.codehaus.groovy/groovy

@Override
public void coerce(ClassNode from, ClassNode target) {
  ClassNode wrapper = ClassHelper.getWrapper(target);
  makeIndyCall(invokeMethod, EmptyExpression.INSTANCE, false, false, "asType", new ClassExpression(wrapper));
  if (ClassHelper.boolean_TYPE.equals(target) || ClassHelper.Boolean_TYPE.equals(target)) {
    writeIndyCast(ClassHelper.OBJECT_TYPE,target);
  } else {
    BytecodeHelper.doCast(controller.getMethodVisitor(), wrapper);
    controller.getOperandStack().replace(wrapper);
    controller.getOperandStack().doGroovyCast(target);
  }
}
origin: org.codehaus.groovy/groovy

private static void addMethod(FieldNode fieldNode, BlockStatement body, ClassNode type) {
  int visibility = ACC_PUBLIC;
  if (fieldNode.isStatic()) visibility |= ACC_STATIC;
  String propName = MetaClassHelper.capitalize(fieldNode.getName().substring(1));
  ClassNode declaringClass = fieldNode.getDeclaringClass();
  addGeneratedMethod(declaringClass, "get" + propName, visibility, type, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, body);
  if (ClassHelper.boolean_TYPE.equals(type)) {
    addGeneratedMethod(declaringClass, "is" + propName, visibility, type,
        Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, stmt(callThisX("get" + propName)));
  }
}
origin: org.codehaus.groovy/groovy

private static String getterName(ClassNode annotatedNode, PropertyNode pNode) {
  String getterName = "get" + MetaClassHelper.capitalize(pNode.getName());
  boolean existingExplicitGetter = annotatedNode.getMethod(getterName, Parameter.EMPTY_ARRAY) != null;
  if (ClassHelper.boolean_TYPE.equals(pNode.getOriginType()) && !existingExplicitGetter) {
    getterName = "is" + MetaClassHelper.capitalize(pNode.getName());
  }
  return getterName;
}
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 static boolean hasUsableImplementation(ClassNode c, MethodNode m) {
  if (c == m.getDeclaringClass()) return false;
  MethodNode found = c.getDeclaredMethod(m.getName(), m.getParameters());
  if (found == null) return false;
  int asp = found.getModifiers() & ABSTRACT_STATIC_PRIVATE;
  int visible = found.getModifiers() & VISIBILITY;
  if (visible != 0 && asp == 0) return true;
  if (c.equals(OBJECT_TYPE)) return false;
  return hasUsableImplementation(c.getSuperClass(), m);
}
origin: org.codehaus.groovy/groovy

private boolean isAssignable(ClassNode node, ClassNode testNode) {
  if (node.isArray() && testNode.isArray()) {
    return isArrayAssignable(node.getComponentType(), testNode.getComponentType());
  }
  if (testNode.isInterface()) {
    if (node.equals(testNode) || node.implementsInterface(testNode)) return true;
  }
  return node.isDerivedFrom(testNode);
}
origin: org.codehaus.groovy/groovy

public void visitField(FieldNode node) {
  if (currentClass.getDeclaredField(node.getName()) != node) {
    addError("The " + getDescription(node) + " is declared multiple times.", node);
  }
  checkInterfaceFieldModifiers(node);
  checkGenericsUsage(node, node.getType());
  if (node.getType().equals(VOID_TYPE)) {
    addError("The " + getDescription(node) + " has invalid type void", node);
  }
  super.visitField(node);
}
org.codehaus.groovy.astClassNodeequals

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
  • 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

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • startActivity (Activity)
  • 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-
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
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