当前位置: 首页>>代码示例>>Java>>正文


Java ReflectionCache.getCachedClass方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:27,代码来源:MetaClassImpl.java

示例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);
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:26,代码来源:MetaClassImpl.java

示例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));
        }
    }
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:11,代码来源:SimpleExtensionModule.java

示例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;
}
 
开发者ID:apache,项目名称:groovy,代码行数:13,代码来源:BytecodeHelper.java

示例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);
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:13,代码来源:GroovyCategorySupport.java

示例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);
}
 
开发者ID:apache,项目名称:groovy,代码行数:8,代码来源:ClosureMetaMethod.java

示例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();
}
 
开发者ID:apache,项目名称:groovy,代码行数:10,代码来源:Closure.java

示例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;
}
 
开发者ID:apache,项目名称:groovy,代码行数:7,代码来源:ClosureStaticMetaMethod.java

示例9: getDeclaringClass

import org.codehaus.groovy.reflection.ReflectionCache; //导入方法依赖的package包/类
public CachedClass getDeclaringClass() {
    return ReflectionCache.getCachedClass(declaringClass);
}
 
开发者ID:apache,项目名称:groovy,代码行数:4,代码来源:ClosureMetaMethod.java


注:本文中的org.codehaus.groovy.reflection.ReflectionCache.getCachedClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。