本文整理汇总了Java中org.codehaus.groovy.reflection.ReflectionCache.getCachedClass方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionCache.getCachedClass方法的具体用法?Java ReflectionCache.getCachedClass怎么用?Java ReflectionCache.getCachedClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.groovy.reflection.ReflectionCache
的用法示例。
在下文中一共展示了ReflectionCache.getCachedClass方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MetaClassImpl
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
/**
* Constructor
*
* @param theClass The class this is the metaclass dor
* @param add The methods for this class
*/
public MetaClassImpl(final Class theClass, MetaMethod[] add) {
this.theClass = theClass;
theCachedClass = ReflectionCache.getCachedClass(theClass);
this.isGroovyObject = GroovyObject.class.isAssignableFrom(theClass);
this.isMap = Map.class.isAssignableFrom(theClass);
this.registry = GroovySystem.getMetaClassRegistry();
metaMethodIndex = new MetaMethodIndex(theCachedClass);
final MetaMethod[] metaMethods = theCachedClass.getNewMetaMethods();
if (add != null && !(add.length == 0)) {
List<MetaMethod> arr = new ArrayList<MetaMethod>();
arr.addAll(Arrays.asList(metaMethods));
arr.addAll(Arrays.asList(add));
myNewMetaMethods = arr.toArray(new MetaMethod[arr.size()]);
additionalMetaMethods = metaMethods;
}
else {
myNewMetaMethods = metaMethods;
additionalMetaMethods = EMPTY;
}
}
示例2: getMetaProperty
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
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);
}
}
示例3: createMetaMethods
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
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));
}
}
}
示例4: box
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
/**
* 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;
}
示例5: use
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
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);
}
}
示例6: ClosureMetaMethod
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
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);
}
示例7: Closure
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
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();
}
示例8: ClosureStaticMetaMethod
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
public ClosureStaticMetaMethod(String name, Class declaringClass, Closure c, Class[] paramTypes) {
super(paramTypes);
this.callable = c;
this.declaringClass = ReflectionCache.getCachedClass(declaringClass);
this.name = name;
}
示例9: getDeclaringClass
import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
public CachedClass getDeclaringClass() {
return ReflectionCache.getCachedClass(declaringClass);
}