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

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

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

origin: org.codehaus.groovy/groovy

if (!method.isStatic() || !method.isPublic())
  continue;
if (method.getCachedMethod().getAnnotation(Deprecated.class) != null)
  continue;
if (method.getParameterTypes().length == 0)
  continue;
final Class returnType = method.getReturnType();
records.add(record);
record.methodName = method.getName();
record.returnType = method.getReturnType();
record.parameters = method.getNativeParameterTypes();
record.className = className;
final String methodDescriptor = BytecodeHelper.getMethodDescriptor(returnType, method.getNativeParameterTypes());
origin: org.codehaus.groovy/groovy

List<CachedMethod> mopMethods = new ArrayList<CachedMethod>(declaredMethods.length);
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

  CachedMethod cachedGetter = CachedMethod.find(method);
  getter = cachedGetter == null ? null : findMethod(cachedGetter);
} else {
method = pd.getWriteMethod();
if (method != null) {
  CachedMethod cachedSetter = CachedMethod.find(method);
  setter = cachedSetter == null ? null : findMethod(cachedSetter);
} else {
origin: org.codehaus.groovy/groovy

public int compareTo(Object o) {
 if (o instanceof CachedMethod)
  return compareToCachedMethod((CachedMethod)o);
 else
  return compareToMethod((Method)o);
}
origin: org.codehaus.groovy/groovy

public String getSignature() {
  return getName() + getDescriptor();
}
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

Class callClass = cachedMethod.getDeclaringClass().getTheClass();
boolean useInterface = callClass.isInterface();
String descriptor = BytecodeHelper.getMethodDescriptor(cachedMethod.getReturnType(), cachedMethod.getNativeParameterTypes());
if (cachedMethod.isStatic()) {
  invokeMethodCode = Opcodes.INVOKESTATIC;
} else {
Method method = cachedMethod.setAccessible();
Class<?>[] parameters = method.getParameterTypes();
int size = parameters.length;
mv.visitMethodInsn(invokeMethodCode, type, cachedMethod.getName(), descriptor, useInterface);
BytecodeHelper.box(mv, cachedMethod.getReturnType());
if (cachedMethod.getReturnType() == void.class) {
  mv.visitInsn(Opcodes.ACONST_NULL);
origin: org.codehaus.groovy/groovy-jdk14

for (int i = 0, cur = 0; i < cachedMethods.length; i++) {
  CachedMethod method = cachedMethods[i];
  if (!method.isStatic() || !method.isPublic())
   continue;
  if (method.getParameterTypes().length == 0)
   continue;
  final Class returnType = method.getReturnType();
  final String methodDescriptor = BytecodeHelper.getMethodDescriptor(returnType, method.getNativeParameterTypes());
  mv.visitCode();
  mv.visitVarInsn(ALOAD,1);
  helper.doCast(method.getParameterTypes()[0].getTheClass());
  loadParameters(method,2,mv);
  mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/DefaultGroovyMethods", method.getName(), methodDescriptor);
  helper.box(returnType);
  if (method.getReturnType() == void.class) {
    mv.visitInsn(ACONST_NULL);
  helper = new BytecodeHelper(mv);
  mv.visitCode();
  if (method.getParamsCount() == 2 && method.getParameterTypes()[0].isNumber && method.getParameterTypes()[1].isNumber) {
    mv.visitVarInsn(ALOAD,1);
    helper.doCast(method.getParameterTypes()[0].getTheClass());
    Class type = method.getParameterTypes()[1].getTheClass();
    if (type.isPrimitive()) {
      helper.unbox(type);
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

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

public static Constructor compilePogoMethod(CachedMethod cachedMethod) {
  ClassWriter cw = makeClassWriter();
  final CachedClass declClass = cachedMethod.getDeclaringClass();
  final CallSiteClassLoader callSiteLoader = declClass.getCallSiteLoader();
  final String name = callSiteLoader.createClassName(cachedMethod.setAccessible());
  final byte[] bytes = genPogoMetaMethodSite(cachedMethod, cw, name);
  
  return callSiteLoader.defineClassAndGetConstructor(name, bytes);
}
origin: org.codehaus.groovy/groovy

private static boolean hasAnnotation(CachedMethod method, Class<Internal> annotationClass) {
  return method.getCachedMethod().getAnnotation(annotationClass) != null;
}
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 createMetaMethods(final Class extensionClass, final List<MetaMethod> metaMethods, final boolean isStatic) {
  CachedClass cachedClass = ReflectionCache.getCachedClass(extensionClass);
  CachedMethod[] methods = cachedClass.getMethods();
  for (CachedMethod method : methods) {
    if (method.isStatic() && method.isPublic() && method.getParamsCount() > 0) {
      // an extension method is found
      metaMethods.add(isStatic?new NewStaticMetaMethod(method) : new NewInstanceMetaMethod(method));
    }
  }
}
origin: com.disney.groovity/groovity-core

if(getter instanceof CachedMethod) {
  CachedMethod cm = (CachedMethod)getter;
  ModelSkip skipAnn = cm.getCachedMethod().getAnnotation(ModelSkip.class);
  if(skipAnn!=null) {
    continue;
  if(cm.isStatic()){
    continue;
  if(!cm.getCachedMethod().getDeclaringClass().equals(c)) {
      Method override = c.getDeclaredMethod(cm.getCachedMethod().getName(), cm.getCachedMethod().getParameterTypes());
      if(override.getAnnotation(ModelSkip.class) !=null) {
        continue;
origin: org.codehaus.groovy/groovy

public PogoCachedMethodSite(CallSite site, MetaClassImpl metaClass, CachedMethod metaMethod, Class[] params) {
  super(site, metaClass, metaMethod, params);
  reflect = metaMethod.setAccessible();
}
origin: groovy/groovy-core

  static void doIt () {

    new A ().protectedMethod();

    try {
      CachedMethod m = CachedMethod.find(A.class.getDeclaredMethod("protectedMethod", new Class [0] ));
      Object[] arguments = new Object[0];
      m.setAccessible().invoke(new A(), arguments);
    } catch (NoSuchMethodException e) {
    } catch (IllegalAccessException e) {
    } catch (InvocationTargetException e) {
    }
  }
}
origin: org.codehaus.groovy/groovy

  public int compare(Object o1, Object o2) {
    if (o1 instanceof CachedMethod)
      return ((CachedMethod)o1).compareTo(o2);
    else if (o2 instanceof CachedMethod)
      return -((CachedMethod)o2).compareTo(o1);
    else
      // really, this should never happen, it's evidence of corruption if it does
      throw new ClassCastException("One of the two comparables must be a CachedMethod");
  }
}
origin: org.codehaus.groovy/groovy-all-minimal

/**
 * Delegated to from the global use(CategoryClass) method.  It scans the Category class for static methods
 * that take 1 or more parameters.  The first parameter is the class you are adding the category method to,
 * additional parameters are those parameters needed by that method.  A use statement cannot be undone and
 * is valid only for the current thread.
 *
 * @param categoryClass the class containing category methods
 */
private static void use(Class categoryClass) {
  Map properties = getProperties();
  List stack = (List) LOCAL.get();
  LinkedList clonedLists = new LinkedList();
  
  Method[] methods = categoryClass.getMethods();
  for (int i = 0; i < methods.length; i++) {
    Method method = methods[i];
    if (Modifier.isStatic(method.getModifiers())) {
      final CachedMethod cachedMethod = CachedMethod.find(method);
      CachedClass[] paramTypes = cachedMethod.getParameterTypes();
      if (paramTypes.length > 0) {
        CachedClass metaClass = paramTypes[0];
        Map metaMethodsMap = getMetaMethods(properties, metaClass.getTheClass());
        List methodList = getMethodList(metaMethodsMap, method.getName());
        MetaMethod mmethod = new CategoryMethod(cachedMethod, metaClass.getTheClass());
        methodList.add(mmethod);
        Collections.sort(methodList);
      }
    }
  }
}
origin: org.codehaus.groovy/groovy

if (LOG_ENABLED) LOG.info("meta method is CachedMethod instance");
CachedMethod cm = (CachedMethod) metaMethod;
isVargs = cm.isVargsMethod();
try {
  Method m = cm.getCachedMethod();
  handle = correctClassForNameAndUnReflectOtherwise(m);
  if (LOG_ENABLED) LOG.info("successfully unreflected method");
org.codehaus.groovy.reflectionCachedMethod

Most used methods

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

Popular in Java

  • Running tasks concurrently on multiple threads
  • setScale (BigDecimal)
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • Kernel (java.awt.image)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • 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