當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。