當前位置: 首頁>>代碼示例>>Java>>正文


Java ClassPool.getDefault方法代碼示例

本文整理匯總了Java中scouter.javassist.ClassPool.getDefault方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassPool.getDefault方法的具體用法?Java ClassPool.getDefault怎麽用?Java ClassPool.getDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scouter.javassist.ClassPool的用法示例。


在下文中一共展示了ClassPool.getDefault方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCtClass

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
public CtClass getCtClass() {
    CtClass clazz = component.getCtClass();
    if (clazz == null)
        return null;

    ClassPool pool = clazz.getClassPool();
    if (pool == null)
        pool = ClassPool.getDefault();

    String name = arrayName(clazz.getName(), dims);

    try {
        return pool.get(name);
    } catch (NotFoundException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:scouter-project,項目名稱:bytescope,代碼行數:18,代碼來源:MultiArrayType.java

示例2: ScopedClassPoolRepositoryImpl

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
/**
 * Singleton.
 */
private ScopedClassPoolRepositoryImpl() {
    classpool = ClassPool.getDefault();
    // FIXME This doesn't look correct
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    classpool.insertClassPath(new LoaderClassPath(cl));
}
 
開發者ID:scouter-project,項目名稱:bytescope,代碼行數:10,代碼來源:ScopedClassPoolRepositoryImpl.java

示例3: main

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
/**
 * Main method.
 *
 * @param args <code>args[0]</code> is the class file name.
 */
public static void main(String[] args) throws Exception {
    if (args.length != 1) {
        System.err.println("Usage: java javassist.tools.framedump <fully-qualified class name>");
        return;
    }
    
    ClassPool pool = ClassPool.getDefault();
    CtClass clazz = pool.get(args[0]);
    System.out.println("Frame Dump of " + clazz.getName() + ":");
    FramePrinter.print(clazz, System.out);
}
 
開發者ID:scouter-project,項目名稱:bytescope,代碼行數:17,代碼來源:framedump.java

示例4: processClasses

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
private static void processClasses(CompiledClass[] entries, int n)
    throws Exception
{
    Reflection implementor = new Reflection();
    ClassPool pool = ClassPool.getDefault();
    implementor.start(pool);

    for (int i = 0; i < n; ++i) {
        CtClass c = pool.get(entries[i].classname);
        if (entries[i].metaobject != null
                                    || entries[i].classobject != null) {
            String metaobj, classobj;

            if (entries[i].metaobject == null)
                metaobj = "javassist.tools.reflect.Metaobject";
            else
                metaobj = entries[i].metaobject;

            if (entries[i].classobject == null)
                classobj = "javassist.tools.reflect.ClassMetaobject";
            else
                classobj = entries[i].classobject;

            if (!implementor.makeReflective(c, pool.get(metaobj),
                                          pool.get(classobj)))
                System.err.println("Warning: " + c.getName()
                            + " is reflective.  It was not changed.");

            System.err.println(c.getName() + ": " + metaobj + ", "
                               + classobj);
        }
        else
            System.err.println(c.getName() + ": not reflective");
    }

    for (int i = 0; i < n; ++i) {
        implementor.onLoad(pool, entries[i].classname);
        pool.get(entries[i].classname).writeFile();
    }
}
 
開發者ID:scouter-project,項目名稱:bytescope,代碼行數:41,代碼來源:Compiler.java

示例5: Loader

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
/**
 * Constructs a new class loader.
 */
public Loader() throws CannotCompileException, NotFoundException {
    super();
    delegateLoadingOf("javassist.tools.reflect.Loader");

    reflection = new Reflection();
    ClassPool pool = ClassPool.getDefault();
    addTranslator(pool, reflection);
}
 
開發者ID:scouter-project,項目名稱:bytescope,代碼行數:12,代碼來源:Loader.java

示例6: main

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
/**
 * Main method.
 *
 * @param args <code>args[0]</code> is the class file name.
 */
public static void main(String[] args) throws Exception {
    if (args.length != 1) {
        System.err.println("Usage: java framedump <fully-qualified class name>");
        return;
    }
    
    ClassPool pool = ClassPool.getDefault();
    CtClass clazz = pool.get(args[0]);
    System.out.println("Frame Dump of " + clazz.getName() + ":");
    FramePrinter.print(clazz, System.out);
}
 
開發者ID:scouter-project,項目名稱:scouter,代碼行數:17,代碼來源:framedump.java

示例7: processClasses

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
private static void processClasses(CompiledClass[] entries, int n)
    throws Exception
{
    Reflection implementor = new Reflection();
    ClassPool pool = ClassPool.getDefault();
    implementor.start(pool);

    for (int i = 0; i < n; ++i) {
        CtClass c = pool.get(entries[i].classname);
        if (entries[i].metaobject != null
                                    || entries[i].classobject != null) {
            String metaobj, classobj;

            if (entries[i].metaobject == null)
                metaobj = "Metaobject";
            else
                metaobj = entries[i].metaobject;

            if (entries[i].classobject == null)
                classobj = "ClassMetaobject";
            else
                classobj = entries[i].classobject;

            if (!implementor.makeReflective(c, pool.get(metaobj),
                                          pool.get(classobj)))
                System.err.println("Warning: " + c.getName()
                            + " is reflective.  It was not changed.");

            System.err.println(c.getName() + ": " + metaobj + ", "
                               + classobj);
        }
        else
            System.err.println(c.getName() + ": not reflective");
    }

    for (int i = 0; i < n; ++i) {
        implementor.onLoad(pool, entries[i].classname);
        pool.get(entries[i].classname).writeFile();
    }
}
 
開發者ID:scouter-project,項目名稱:scouter,代碼行數:41,代碼來源:Compiler.java

示例8: Loader

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
/**
 * Constructs a new class loader.
 */
public Loader() throws CannotCompileException, NotFoundException {
    super();
    delegateLoadingOf("Loader");

    reflection = new Reflection();
    ClassPool pool = ClassPool.getDefault();
    addTranslator(pool, reflection);
}
 
開發者ID:scouter-project,項目名稱:scouter,代碼行數:12,代碼來源:Loader.java

示例9: getClassPool

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
private ClassPool getClassPool(Type rootComponent) {
    ClassPool pool = rootComponent.clazz.getClassPool();
    return pool != null ? pool : ClassPool.getDefault();
}
 
開發者ID:scouter-project,項目名稱:bytescope,代碼行數:5,代碼來源:Type.java

示例10: AppletServer

import scouter.javassist.ClassPool; //導入方法依賴的package包/類
/**
 * Constructs a web server.
 *
 * @param port      port number
 */
public AppletServer(int port)
    throws IOException, NotFoundException, CannotCompileException
{
    this(ClassPool.getDefault(), new StubGenerator(), port);
}
 
開發者ID:scouter-project,項目名稱:bytescope,代碼行數:11,代碼來源:AppletServer.java


注:本文中的scouter.javassist.ClassPool.getDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。