public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(declaringClass); }
public ClosureStaticMetaMethod(String name, Class declaringClass, Closure c, Class[] paramTypes) { super(paramTypes); this.callable = c; this.declaringClass = ReflectionCache.getCachedClass(declaringClass); this.name = name; }
public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(declaringClass); }
public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(declaringClass); }
public CachedMethod(Method method) { this(ReflectionCache.getCachedClass(method.getDeclaringClass()),method); }
public CachedConstructor(Constructor c) { this(ReflectionCache.getCachedClass(c.getDeclaringClass()), c); }
public ClosureMetaMethod(String name, Class declaringClass, Closure c, CachedMethod doCall) { super (doCall.getNativeParameterTypes()); this.name = name; callable = c; this.doCall = doCall; this.declaringClass = ReflectionCache.getCachedClass(declaringClass); }
public Set<CachedClass> initValue() { Set<CachedClass> res = new HashSet<CachedClass> (0); Class[] classes = getTheClass().getInterfaces(); for (Class cls : classes) { res.add(ReflectionCache.getCachedClass(cls)); } return res; } };
public CachedClass initValue() { if (!isArray) return ReflectionCache.getCachedClass(getTheClass().getSuperclass()); else if (cachedClass.getComponentType().isPrimitive() || cachedClass.getComponentType() == Object.class) return ReflectionCache.OBJECT_CLASS; else return ReflectionCache.OBJECT_ARRAY_CLASS; } };
public static CachedMethod find(Method method) { CachedMethod[] methods = ReflectionCache.getCachedClass(method.getDeclaringClass()).getMethods(); // for (int i = 0; i < methods.length; i++) { // CachedMethod cachedMethod = methods[i]; // if (cachedMethod.cachedMethod.equals(method)) // return cachedMethod; // } // return null; int i = Arrays.binarySearch(methods, method, COMPARATOR); if (i < 0) return null; return methods[i]; }
public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(self.getTheClass()); } };
public static CachedConstructor find(Constructor constructor) { CachedConstructor[] constructors = ReflectionCache.getCachedClass(constructor.getDeclaringClass()).getConstructors(); for (int i = 0; i < constructors.length; i++) { CachedConstructor cachedConstructor = constructors[i]; if (cachedConstructor.cachedConstructor.equals(constructor)) return cachedConstructor; } throw new RuntimeException("Couldn't find method: " + constructor); }
private void use(Class categoryClass) { CachedClass cachedClass = ReflectionCache.getCachedClass(categoryClass); LinkedList<CachedClass> classStack = new LinkedList<CachedClass>(); for (CachedClass superClass = cachedClass; superClass.getTheClass()!=Object.class; superClass = superClass.getCachedSuperClass()) { classStack.add(superClass); } while (!classStack.isEmpty()) { CachedClass klazz = classStack.removeLast(); applyUse(klazz); } }
/** * Generates the bytecode to autobox the current value on the stack */ @Deprecated public static boolean box(MethodVisitor mv, Class type) { if (ReflectionCache.getCachedClass(type).isPrimitive && type != void.class) { String returnString = "(" + BytecodeHelper.getTypeDescription(type) + ")Ljava/lang/Object;"; mv.visitMethodInsn(INVOKESTATIC, DTT_CLASSNAME, "box", returnString, false); return true; } return false; }
public Closure(Object owner, Object thisObject) { this.owner = owner; this.delegate = owner; this.thisObject = thisObject; final CachedClosureClass cachedClass = (CachedClosureClass) ReflectionCache.getCachedClass(getClass()); parameterTypes = cachedClass.getParameterTypes(); maximumNumberOfParameters = cachedClass.getMaximumNumberOfParameters(); }
public ThreadBoundSetter(String name) { setParametersTypes (new CachedClass [] {ReflectionCache.getCachedClass(type)} ); this.name = getSetterName(name); }
public Set<CachedClass> initValue() { Set<CachedClass> res = new HashSet<CachedClass> (0); if (getTheClass().isInterface()) res.add(CachedClass.this); Class[] classes = getTheClass().getInterfaces(); for (Class cls : classes) { final CachedClass aClass = ReflectionCache.getCachedClass(cls); if (!res.contains(aClass)) res.addAll(aClass.getInterfaces()); } final CachedClass superClass = getCachedSuperClass(); if (superClass != null) res.addAll(superClass.getInterfaces()); return res; } };
private synchronized void getParametersTypes0() { if (parameterTypes != null) return; Class[] npt = nativeParamTypes == null ? getPT() : nativeParamTypes; if (npt.length == 0) { nativeParamTypes = NO_PARAMETERS; setParametersTypes(CachedClass.EMPTY_ARRAY); } else { CachedClass[] pt = new CachedClass[npt.length]; for (int i = 0; i != npt.length; ++i) pt[i] = ReflectionCache.getCachedClass(npt[i]); nativeParamTypes = npt; setParametersTypes(pt); } }
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)); } } }
private MetaProperty getMetaProperty(Class _clazz, String name, boolean useSuper, boolean useStatic) { if (_clazz == theClass) return getMetaProperty(name, useStatic); CachedClass clazz = ReflectionCache.getCachedClass(_clazz); while (true) { SingleKeyHashMap propertyMap; if (useStatic) { propertyMap = staticPropertyIndex; } else if (useSuper) { propertyMap = classPropertyIndexForSuper.getNullable(clazz); } else { propertyMap = classPropertyIndex.getNullable(clazz); } if (propertyMap == null) { if (clazz != theCachedClass) { clazz = theCachedClass; continue; } else { return null; } } return (MetaProperty) propertyMap.get(name); } }