congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ClassNode.getGetterMethod
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: org.codehaus.groovy/groovy

public MethodNode getGetterMethod(String getterName) {
  return getGetterMethod(getterName, true);
}
origin: org.codehaus.groovy/groovy

private static void extractAccessorInfo(ClassNode owner, String name, Reference<Boolean> willHaveGetAccessor, Reference<Boolean> willHaveIsAccessor) {
  String suffix = Verifier.capitalize(name);
  boolean hasGetAccessor = owner.getGetterMethod("get" + suffix) != null;
  boolean hasIsAccessor = owner.getGetterMethod("is" + suffix) != null;
  PropertyNode prop = owner.getProperty(name);
  willHaveGetAccessor.set(hasGetAccessor || (prop != null && !hasIsAccessor));
  willHaveIsAccessor.set(hasIsAccessor || (prop != null && !hasGetAccessor && prop.getOriginType().equals(ClassHelper.boolean_TYPE)));
}

origin: org.codehaus.groovy/groovy

private MethodNode findGetter(ClassNode current, String name, boolean searchOuterClasses) {
  MethodNode getterMethod = current.getGetterMethod(name);
  if (getterMethod == null && searchOuterClasses && current instanceof InnerClassNode) {
    return findGetter(current.getOuterClass(), name, true);
  }
  return getterMethod;
}
origin: org.codehaus.groovy/groovy

private MethodNode findValidGetter(ClassNode classNode, String name) {
  MethodNode getterMethod = classNode.getGetterMethod(name);
  if (getterMethod != null && (getterMethod.isPublic() || getterMethod.isProtected())) {
    return getterMethod;
  }
  return null;
}
origin: org.codehaus.groovy/groovy

private MethodNode findGetterOfSuperClass(ClassNode classNode, FieldNode fieldNode) {
  String getterMethodName = "get" + MetaClassHelper.capitalize(fieldNode.getName());
  return classNode.getSuperClass().getGetterMethod(getterMethodName);
}
origin: org.codehaus.groovy/groovy

private static void addGetterIfNeeded(DelegateDescription delegate, PropertyNode prop, String name, boolean allNames) {
  boolean isPrimBool = prop.getOriginType().equals(ClassHelper.boolean_TYPE);
  // do a little bit of pre-work since Groovy compiler hasn't added property accessors yet
  boolean willHaveGetAccessor = true;
  boolean willHaveIsAccessor = isPrimBool;
  String suffix = Verifier.capitalize(name);
  if (isPrimBool) {
    ClassNode cNode = prop.getDeclaringClass();
    if (cNode.getGetterMethod("is" + suffix) != null && cNode.getGetterMethod("get" + suffix) == null)
      willHaveGetAccessor = false;
    if (cNode.getGetterMethod("get" + suffix) != null && cNode.getGetterMethod("is" + suffix) == null)
      willHaveIsAccessor = false;
  }
  Reference<Boolean> ownerWillHaveGetAccessor = new Reference<Boolean>();
  Reference<Boolean> ownerWillHaveIsAccessor = new Reference<Boolean>();
  extractAccessorInfo(delegate.owner, name, ownerWillHaveGetAccessor, ownerWillHaveIsAccessor);
  for (String prefix : new String[]{"get", "is"}) {
    String getterName = prefix + suffix;
    if ((prefix.equals("get") && willHaveGetAccessor && !ownerWillHaveGetAccessor.get()
        || prefix.equals("is") && willHaveIsAccessor && !ownerWillHaveIsAccessor.get())
        && !shouldSkipPropertyMethod(name, getterName, delegate.excludes, delegate.includes, allNames)) {
      addGeneratedMethod(delegate.owner, getterName,
          ACC_PUBLIC,
          GenericsUtils.nonGeneric(prop.getType()),
          Parameter.EMPTY_ARRAY,
          null,
          returnS(propX(delegate.getOp, name)));
    }
  }
}
origin: org.codehaus.groovy/groovy

public MethodNode getGetterMethod(String getterName, boolean searchSuperClasses) {
  MethodNode getterMethod = null;
  boolean booleanReturnOnly = getterName.startsWith("is");
  for (MethodNode method : getDeclaredMethods(getterName)) {
    if (getterName.equals(method.getName())
        && ClassHelper.VOID_TYPE!=method.getReturnType()
        && method.getParameters().length == 0
        && (!booleanReturnOnly || ClassHelper.Boolean_TYPE.equals(ClassHelper.getWrapper(method.getReturnType())))) {
      // GROOVY-7363: There can be multiple matches for a getter returning a generic parameter type, due to
      // the generation of a bridge method. The real getter is really the non-bridge, non-synthetic one as it
      // has the most specific and exact return type of the two. Picking the bridge method results in loss of
      // type information, as it down-casts the return type to the lower bound of the generic parameter.
      if (getterMethod == null || getterMethod.isSynthetic()) {
        getterMethod = method;
      }
    }
  }
  if (getterMethod != null) return getterMethod;
  if (searchSuperClasses) {
    ClassNode parent = getSuperClass();
    if (parent != null) return parent.getGetterMethod(getterName);
  }
  return null;
}
origin: org.codehaus.groovy/groovy

MethodNode getter = classNode.getGetterMethod(getterName, !node.isStatic());
if (getter == null && ClassHelper.boolean_TYPE == node.getType()) {
  String secondGetterName = "is" + capitalize(name);
  getter = classNode.getGetterMethod(secondGetterName);
origin: org.codehaus.groovy/groovy

private boolean makeGetPropertyWithGetter(final Expression receiver, final ClassNode receiverType, final String methodName, final boolean safe, final boolean implicitThis) {
  MethodNode getterNode = receiverType.getGetterMethod(getterName);
  if (getterNode==null) {
    getterName = "is" + MetaClassHelper.capitalize(methodName);
    getterNode = receiverType.getGetterMethod(getterName);
origin: org.codehaus.groovy/groovy

MethodNode getterMethod = null;
for (ClassNode anInterface : allInterfaces) {
  getterMethod = anInterface.getGetterMethod(getterName);
  if (getterMethod == null) getterMethod = anInterface.getGetterMethod(altGetterName);
  if (getterMethod != null) break;
  getterMethod = OBJECT_TYPE.getGetterMethod(getterName);
origin: org.codehaus.groovy/groovy

MethodNode getter = cNode.getGetterMethod(getterName);
if (getter == null && ClassHelper.boolean_TYPE == node.getType()) {
  String secondGetterName = "is" + Verifier.capitalize(name);
  getter = cNode.getGetterMethod(secondGetterName);
origin: org.chromattic/chromattic.groovy

public static MethodNode getGetter(ClassNode classNode, FieldNode fieldNode) {
 return classNode.getGetterMethod(GroovyUtils.getsetName(GroovyUtils.GetSet.GET, fieldNode.getName()));
}
origin: org.codehaus.groovy/groovy-all-minimal

public MethodNode getGetterMethod(String getterName) {
  for (Iterator iter = getDeclaredMethods(getterName).iterator(); iter.hasNext();) {
    MethodNode method = (MethodNode) iter.next();
    if (getterName.equals(method.getName())
        && ClassHelper.VOID_TYPE!=method.getReturnType()
        && method.getParameters().length == 0) {
      return method;
    }
  }
  ClassNode parent = getSuperClass(); 
  if (parent!=null) return parent.getGetterMethod(getterName); 
  return null;
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public MethodNode getGetterMethod(String getterName) {
  for (MethodNode method : getDeclaredMethods(getterName)) {
    if (getterName.equals(method.getName())
        && ClassHelper.VOID_TYPE!=method.getReturnType()
        && method.getParameters().length == 0) {
      return method;
    }
  }
  ClassNode parent = getSuperClass();
  if (parent!=null) return parent.getGetterMethod(getterName);
  return null;
}
origin: org.codehaus.groovy/groovy-jdk14

public MethodNode getGetterMethod(String getterName) {
  for (Object o : getDeclaredMethods(getterName)) {
    MethodNode method = (MethodNode) o;
    if (getterName.equals(method.getName())
        && ClassHelper.VOID_TYPE!=method.getReturnType()
        && method.getParameters().length == 0) {
      return method;
    }
  }
  ClassNode parent = getSuperClass();
  if (parent!=null) return parent.getGetterMethod(getterName);
  return null;
}
origin: org.kohsuke.droovy/groovy

public MethodNode getGetterMethod(String getterName) {
  for (Object o : getDeclaredMethods(getterName)) {
    MethodNode method = (MethodNode) o;
    if (getterName.equals(method.getName())
        && ClassHelper.VOID_TYPE!=method.getReturnType()
        && method.getParameters().length == 0) {
      return method;
    }
  }
  ClassNode parent = getSuperClass();
  if (parent!=null) return parent.getGetterMethod(getterName);
  return null;
}
origin: org.netbeans.modules/org-netbeans-modules-groovy-editor

String name = propertyNode.getName();
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
MethodNode getter = classNode.getGetterMethod("get" + name); // NOI18N
if (getter != null) {
  genMethod(classNode, getter, out, false);
origin: org.codehaus.groovy/groovy-jdk14

private void addGetterIfNeeded(FieldNode fieldNode, ClassNode owner, PropertyNode prop, String name) {
  String getterName = "get" + Verifier.capitalize(name);
  if (owner.getGetterMethod(getterName) == null) {
    owner.addMethod(getterName,
        ACC_PUBLIC,
        nonGeneric(prop.getType()),
        Parameter.EMPTY_ARRAY,
        null,
        new ReturnStatement(
            new PropertyExpression(
                new FieldExpression(fieldNode),
                name)));
  }
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

private void addGetterIfNeeded(FieldNode fieldNode, ClassNode owner, PropertyNode prop, String name) {
  String getterName = "get" + Verifier.capitalize(name);
  if (owner.getGetterMethod(getterName) == null) {
    owner.addMethod(getterName,
        ACC_PUBLIC,
        nonGeneric(prop.getType()),
        Parameter.EMPTY_ARRAY,
        null,
        new ReturnStatement(
            new PropertyExpression(
                new VariableExpression(fieldNode),
                name)));
  }
}
origin: org.codehaus.groovy/groovy-all-minimal

MethodNode getter = classNode.getGetterMethod(getterName);
if(getter == null && ClassHelper.boolean_TYPE==node.getType()) {
  String secondGetterName = "is" + capitalize(name);
  getter = classNode.getGetterMethod(secondGetterName);
org.codehaus.groovy.astClassNodegetGetterMethod

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

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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