Tabnine Logo
CachedMethod.getName
Code IndexAdd Tabnine to your IDE (free)

How to use
getName
method
in
org.codehaus.groovy.reflection.CachedMethod

Best Java code snippets using org.codehaus.groovy.reflection.CachedMethod.getName (Showing top 20 results out of 315)

origin: org.codehaus.groovy/groovy

public String getName() {
  return method.getName();
}
origin: org.codehaus.groovy/groovy

  public int compare(Object o1, Object o2) {
     return ((CachedMethod)o1).getName().compareTo(((CachedMethod)o2).getName());
  }
}
origin: org.codehaus.groovy/groovy

  public int compare(Object o1, Object o2) {
    if (o1 instanceof CachedMethod)
     return ((CachedMethod)o1).getName().compareTo((String)o2);
    else
     return ((String)o1).compareTo(((CachedMethod)o2).getName());
  }
}
origin: org.codehaus.groovy/groovy

private int findMatchingMethod(MetaMethod method, String mopName, int index, CachedMethod[] mopMethods) {
  int from = index;
  while (from > 0 && mopMethods[from-1].getName().equals(mopName))
   from--;
  int to = index;
  while (to < mopMethods.length-1 && mopMethods[to+1].getName().equals(mopName))
   to++;
  return findMatchingMethod(mopMethods, from, to, method);
}
origin: org.codehaus.groovy/groovy

public String getSignature() {
  return getName() + getDescriptor();
}
origin: org.codehaus.groovy/groovy

private int compareToMethod(Method other) {
  if (other == null)
    return -1;
  final int strComp = getName().compareTo(other.getName());
  if (strComp != 0)
    return strComp;
  final int retComp = getReturnType().getName().compareTo(other.getReturnType().getName());
  if (retComp != 0)
    return retComp;
  CachedClass[] params = getParameterTypes();
  Class[] mparams = other.getParameterTypes();
  final int pd = params.length - mparams.length;
  if (pd != 0)
    return pd;
  for (int i = 0; i != params.length; ++i) {
    final int nameComp = params[i].getName().compareTo(mparams[i].getName());
    if (nameComp != 0)
      return nameComp;
  }
  return 0;
}
origin: org.codehaus.groovy/groovy

public CachedClosureClass(Class klazz, ClassInfo classInfo) {
  super(klazz, classInfo);
  CachedMethod methods [] = getMethods();
  // set it to -1 for starters so parameterTypes will always get a type
  int maximumNumberOfParameters = -1;
  Class[] parameterTypes = null;
  for (CachedMethod method : methods) {
    if ("doCall".equals(method.getName())) {
      final Class[] pt = method.getNativeParameterTypes();
      if (pt.length > maximumNumberOfParameters) {
        parameterTypes = pt;
        maximumNumberOfParameters = parameterTypes.length;
      }
    }
  }
  // this line should be useless, but well, just in case
  maximumNumberOfParameters = Math.max(maximumNumberOfParameters,0);
  this.maximumNumberOfParameters = maximumNumberOfParameters;
  this.parameterTypes = parameterTypes;
}
origin: org.codehaus.groovy/groovy

for (int i = 0; i != declaredMethods.length; ++i) {
  final CachedMethod cachedMethod = new CachedMethod(CachedClass.this, declaredMethods[i]);
  final String name = cachedMethod.getName();
origin: org.codehaus.groovy/groovy

public synchronized void initialize() {
  if (!isInitialized()) {
    CachedMethod[] methodArray = theCachedClass.getMethods();
    synchronized (theCachedClass) {
      for (final CachedMethod cachedMethod : methodArray) {
        if (!cachedMethod.getName().equals(CLOSURE_DO_CALL_METHOD)) continue;
        closureMethods.add(cachedMethod);
      }
    }
    assignMethodChooser();
    initialized = true;
  }
}
origin: org.codehaus.groovy/groovy

  protected Object noSuchMethod(CachedMethod method, Object object, Object[] arguments) {
    throw new MissingMethodException(method.getName(), method.getDeclaringClass().getTheClass(), arguments, false);
  }
}
origin: org.codehaus.groovy/groovy

public CachedMethod searchMethods(String name, CachedClass[] parameterTypes) {
  CachedMethod[] methods = getMethods();
  CachedMethod res = null;
  for (CachedMethod m : methods) {
    if (m.getName().equals(name)
        && ReflectionCache.arrayContentsEq(parameterTypes, m.getParameterTypes())
        && (res == null || res.getReturnType().isAssignableFrom(m.getReturnType())))
      res = m;
  }
  return res;
}
origin: org.codehaus.groovy/groovy

private int compareToCachedMethod(CachedMethod other) {
  if (other == null)
    return -1;
  final int strComp = getName().compareTo(other.getName());
  if (strComp != 0)
    return strComp;
  final int retComp = getReturnType().getName().compareTo(other.getReturnType().getName());
  if (retComp != 0)
    return retComp;
  CachedClass[] params = getParameterTypes();
  CachedClass[] otherParams = other.getParameterTypes();
  final int pd = params.length - otherParams.length;
  if (pd != 0)
    return pd;
  for (int i = 0; i != params.length; ++i) {
    final int nameComp = params[i].getName().compareTo(otherParams[i].getName());
    if (nameComp != 0)
      return nameComp;
  }
  final int classComp = cachedClass.toString().compareTo(other.getDeclaringClass().toString());
  if (classComp != 0)
    return classComp;
  throw new RuntimeException("Should never happen");
}
origin: org.codehaus.groovy/groovy

public static boolean isCompilable (CachedMethod method) {
  return (GroovySunClassLoader.sunVM != null || Modifier.isPublic(method.cachedClass.getModifiers()) && method.isPublic() && publicParams(method))
      && !AndroidSupport.isRunningAndroid() && containsOnlyValidChars(method.getName());
}
origin: org.codehaus.groovy/groovy

public static List<MetaMethod> createMethodList(final String name, final Class declaringClass, final Closure closure) {
  List<MetaMethod> res = new ArrayList<MetaMethod>();
  if (closure instanceof MethodClosure) {
    MethodClosure methodClosure = (MethodClosure) closure;
    Object owner = closure.getOwner();
    Class ownerClass = (Class) (owner instanceof Class ? owner : owner.getClass());
    for (CachedMethod method : ReflectionCache.getCachedClass(ownerClass).getMethods() ) {
      if (method.getName().equals(methodClosure.getMethod())) {
        MetaMethod metaMethod = new MethodClosureMetaMethod(name, declaringClass, closure, method); 
        res.add(adjustParamTypesForStdMethods(metaMethod, name));
      }
    }
  }
  else {
    if (closure instanceof GeneratedClosure) {
      for (CachedMethod method : ReflectionCache.getCachedClass(closure.getClass()).getMethods() ) {
        if (method.getName().equals("doCall")) {
          MetaMethod metaMethod = new ClosureMetaMethod(name, declaringClass, closure, method);
          res.add(adjustParamTypesForStdMethods(metaMethod, name));
        }
      }
    }
    else {
      MetaMethod metaMethod = new AnonymousMetaMethod(closure, name, declaringClass);
      res.add(adjustParamTypesForStdMethods(metaMethod, name));
    }
  }
  return res;
}

origin: org.codehaus.groovy/groovy

  /**
   * @return the matching method which should be found
   */
  private MetaMethod findMethod(CachedMethod aMethod) {
    Object methods = getMethods(theClass, aMethod.getName(), false);
    if (methods instanceof FastArray) {
      FastArray m  = (FastArray) methods;
      final int len = m.size;
      final Object data[] = m.getArray();
      for (int i = 0; i != len; ++i) {
        MetaMethod method = (MetaMethod) data[i];
        if (method.isMethod(aMethod)) {
          return method;
        }
      }
    }
    else {
      MetaMethod method = (MetaMethod) methods;
      if (method.getName().equals(aMethod.getName())
//                    TODO: should be better check for case when only diff in modifiers can be SYNTHETIC flag
//                    && method.getModifiers() == aMethod.getModifiers()
          && method.getReturnType().equals(aMethod.getReturnType())
          && MetaMethod.equal(method.getParameterTypes(), aMethod.getParameterTypes())) {
        return method;
      }
    }
    return aMethod;
  }

origin: org.codehaus.groovy/groovy

records.add(record);
record.methodName = method.getName();
record.returnType = method.getReturnType();
record.parameters = method.getNativeParameterTypes();
origin: org.codehaus.groovy/groovy

private void applyUse(CachedClass cachedClass) {
  CachedMethod[] methods = cachedClass.getMethods();
  for (CachedMethod cachedMethod : methods) {
    if (cachedMethod.isStatic() && cachedMethod.isPublic()) {
      CachedClass[] paramTypes = cachedMethod.getParameterTypes();
      if (paramTypes.length > 0) {
        CachedClass metaClass = paramTypes[0];
        CategoryMethod mmethod = new CategoryMethod(cachedMethod, metaClass.getTheClass());
        final String name = cachedMethod.getName();
        CategoryMethodList list = get(name);
        if (list == null || list.level != level) {
          list = new CategoryMethodList(name, level, list);
          put(name, list);
        }
        list.add(mmethod);
        Collections.sort(list);
        cachePropertyAccessor(mmethod);
      }
    }
  }
}
origin: org.codehaus.groovy/groovy

private static void createInvokeMethod(CachedMethod method, ClassWriter cw, Class returnType, String methodDescriptor) {
  MethodVisitor mv;
  mv = cw.visitMethod(ACC_PUBLIC, "invoke", "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;", null, null);
  mv.visitCode();
  mv.visitVarInsn(ALOAD, 1);
  BytecodeHelper.doCast(mv, method.getParameterTypes()[0].getTheClass());
  loadParameters(method, 2, mv);
  mv.visitMethodInsn(INVOKESTATIC, BytecodeHelper.getClassInternalName(method.getDeclaringClass().getTheClass()), method.getName(), methodDescriptor, false);
  BytecodeHelper.box(mv, returnType);
  if (method.getReturnType() == void.class) {
    mv.visitInsn(ACONST_NULL);
  }
  mv.visitInsn(ARETURN);
  mv.visitMaxs(0, 0);
  mv.visitEnd();
}
origin: org.codehaus.groovy/groovy

mv.visitMethodInsn(invokeMethodCode, type, cachedMethod.getName(), descriptor, useInterface);
origin: org.codehaus.groovy/groovy

  loadParameters(method, 2, mv);
mv.visitMethodInsn(INVOKESTATIC, BytecodeHelper.getClassInternalName(method.getDeclaringClass().getTheClass()), method.getName(), methodDescriptor, false);
BytecodeHelper.box(mv, returnType);
if (method.getReturnType() == void.class) {
org.codehaus.groovy.reflectionCachedMethodgetName

Popular methods of CachedMethod

  • getCachedMethod
  • <init>
  • find
  • isStatic
  • setAccessible
  • compareTo
  • compareToCachedMethod
  • compareToMethod
  • getDeclaringClass
  • getDescriptor
  • getModifiers
  • getNativeParameterTypes
  • getModifiers,
  • getNativeParameterTypes,
  • getParameterTypes,
  • getReturnType,
  • toString,
  • correctArguments,
  • createPogoMetaMethodSite,
  • createPojoMetaMethodSite,
  • createStaticMetaMethodSite

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • setScale (BigDecimal)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Table (org.hibernate.mapping)
    A relational table
  • Top 12 Jupyter Notebook extensions
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