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

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

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

origin: org.codehaus.groovy/groovy

public int getParamsCount() {
  return getParameterTypes().length;
}
origin: org.codehaus.groovy/groovy

public NewMetaMethod(CachedMethod method) {
  super(method);
  bytecodeParameterTypes = method.getParameterTypes();
  int size = bytecodeParameterTypes.length;
  CachedClass[] logicalParameterTypes;
  if (size <= 1) {
    logicalParameterTypes = EMPTY_TYPE_ARRAY;
  } else {
    logicalParameterTypes = new CachedClass[--size];
    System.arraycopy(bytecodeParameterTypes, 1, logicalParameterTypes, 0, size);
  }
  setParametersTypes(logicalParameterTypes);
}
origin: org.codehaus.groovy/groovy

public ReflectionMetaMethod(CachedMethod method) {
  this.method = method;
  setParametersTypes(method.getParameterTypes());
}
origin: org.codehaus.groovy/groovy

private int findMatchingMethod(CachedMethod[] data, int from, int to, MetaMethod method) {
  for (int j = from; j <= to; ++j) {
    CachedMethod aMethod = data[j];
    CachedClass[] params1 = aMethod.getParameterTypes();
    CachedClass[] params2 = method.getParameterTypes();
    if (params1.length == params2.length) {
      boolean matches = true;
      for (int i = 0; i < params1.length; i++) {
        if (params1[i] != params2[i]) {
          matches = false;
          break;
        }
      }
      if (matches) {
        return j;
      }
    }
  }
  return -1;
}
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 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

final int mod = method.getModifiers();
if (Modifier.isStatic(mod) && Modifier.isPublic(mod) && method.getCachedMethod().getAnnotation(Deprecated.class) == null) {
  CachedClass[] paramTypes = method.getParameterTypes();
  if (paramTypes.length > 0) {
    List<MetaMethod> arr = map.get(paramTypes[0]);
origin: org.codehaus.groovy/groovy

private static void staticMethod(final MetaClass self, List<MetaMethod> arr, final CachedMethod method) {
  CachedClass[] paramTypes = method.getParameterTypes();
  if (paramTypes.length == 0)
    return;
  NewInstanceMetaMethod metaMethod;
  if (paramTypes[0].isAssignableFrom(self.getTheClass())) {
    if (paramTypes[0].getTheClass() == self.getTheClass())
      metaMethod = new NewInstanceMetaMethod(method);
    else
      metaMethod = new NewInstanceMetaMethod(method) {
        public CachedClass getDeclaringClass() {
          return ReflectionCache.getCachedClass(self.getTheClass());
        }
      };
    arr.add(metaMethod);
  } else {
    if (self.getTheClass().isAssignableFrom(paramTypes[0].getTheClass())) {
      metaMethod = new NewInstanceMetaMethod(method);
      arr.add(metaMethod);
    }
  }
}
origin: org.codehaus.groovy/groovy

  protected static void loadParameters(CachedMethod method, int argumentIndex, MethodVisitor mv) {
    CachedClass[] parameters = method.getParameterTypes();
    int size = parameters.length - 1;
    for (int i = 0; i < size; i++) {
      // unpack argument from Object[]
      mv.visitVarInsn(ALOAD, argumentIndex);
      BytecodeHelper.pushConstant(mv, i);
      mv.visitInsn(AALOAD);

      // cast argument to parameter class, inclusive unboxing
      // for methods with primitive types
      Class type = parameters[i + 1].getTheClass();
      BytecodeHelper.doCast(mv, type);
    }
  }
}
origin: org.codehaus.groovy/groovy

  continue;
if (method.getParameterTypes().length == 0)
  continue;
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

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

mv = cw.visitMethod(ACC_PUBLIC + ACC_FINAL, "doMethodInvoke", "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;", null, null);
mv.visitCode();
if (method.getParamsCount() == 2 && method.getParameterTypes()[0].isNumber && method.getParameterTypes()[1].isNumber) {
  mv.visitVarInsn(ALOAD, 1);
  BytecodeHelper.doCast(mv, method.getParameterTypes()[0].getTheClass());
  Class type = method.getParameterTypes()[1].getTheClass();
  BytecodeHelper.doCast(mv, type);
} else {
  mv.visitVarInsn(ASTORE, 2);
  mv.visitVarInsn(ALOAD, 1);
  BytecodeHelper.doCast(mv, method.getParameterTypes()[0].getTheClass());
  loadParameters(method, 2, mv);
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

private static void createIsValidMethodMethod(CachedMethod method, ClassWriter cw, String className) {
  MethodVisitor mv;
  if (method.getParamsCount() == 2 && method.getParameterTypes()[0].isNumber && method.getParameterTypes()[1].isNumber) {
origin: org.codehaus.groovy/groovy-all-minimal

public boolean canBeCalledByReflector () {
    if (!Modifier.isPublic(cachedClass.getModifiers()))
      return false;
    if (!Modifier.isPublic(getModifiers()))
     return false;
    getParameterTypes();
    for (int i = 0; i != parameterTypes.length; ++i) {
      if (!parameterTypes[i].isPrimitive && !Modifier.isPublic(parameterTypes[i].getModifiers()))
       return false;
    }
  return true;
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

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.kohsuke.droovy/groovy

public CachedMethod searchMethods(String name, CachedClass[] parameterTypes) {
  CachedMethod[] methods = getMethods();
  CachedMethod res = null;
  for (int i = 0; i < methods.length; i++) {
    CachedMethod m = methods[i];
    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-all-minimal

public CachedMethod searchMethods(String name, CachedClass[] parameterTypes) {
  CachedMethod[] methods = getMethods();
  CachedMethod res = null;
  for (int i = 0; i < methods.length; i++) {
    CachedMethod m = methods[i];
    if (m.getName().equals(name)
        && ReflectionCache.arrayContentsEq(parameterTypes, m.getParameterTypes())
        && (res == null || res.getReturnType().isAssignableFrom(m.getReturnType())))
      res = m;
  }
  return res;
}
org.codehaus.groovy.reflectionCachedMethodgetParameterTypes

Popular methods of CachedMethod

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

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top plugins for WebStorm
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