Package javassist

Examples of javassist.LoaderClassPath


      Class wrapperType;
      try
      {
         ClassPool pool = new ClassPool(true);
         pool.appendClassPath(new LoaderClassPath(loader));
         CtClass clazz = pool.makeClass(wrapperName);
         clazz.setSuperclass(pool.get(WrapperType.class.getName()));

         for (WrappedParameter param : wrappedParameters)
         {
View Full Code Here


        }

        public void buildClassPool() {
            classPool = new ClassPool();
            classPool.appendSystemPath();
            classPool.appendClassPath(new LoaderClassPath(classLoader.getClassLoader()));
        }
View Full Code Here

           
            final ClassLoader classLoader =
                    ClassLoaderUtils.getClassLoader(OgnlVariableExpressionEvaluator.class);
           
            final ClassPool pool = new ClassPool(true);
            pool.insertClassPath(new LoaderClassPath(classLoader));

            final CtClass[] params = new CtClass[] { pool.get(Object.class.getName()) };
           
            // We must load by class name here instead of "OgnlOps.class.getName()" because
            // the latter would cause the class to be loaded and therefore it would not be
View Full Code Here

    }
    return instance;
  }

  public static void addClassLoader(ClassLoader cl) {
    getInstance().pool.appendClassPath(new LoaderClassPath(cl));
  }
View Full Code Here

    boolean appended = false;
    ClassLoader cl = null;
    try {
      cl = Thread.currentThread().getContextClassLoader();
      if (cl != null) {
        pool.appendClassPath(new LoaderClassPath(cl));
        appended = true;
      }
    } catch (SecurityException e) {
      LOG.debug("Cannot append a search path of context classloader", e);
    }
    try {
      ClassLoader cl2 = getClass().getClassLoader();
      if (cl2 != null && cl2 != cl) {
        pool.appendClassPath(new LoaderClassPath(cl2));
        appended = true;
      }
    } catch (SecurityException e) {
      LOG.debug("Cannot append a search path of classloader", e);
    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    protected void appendClassPath(final ClassPool pool) {
        super.appendClassPath(pool);
        pool.appendClassPath(new LoaderClassPath(Activator.class.getClassLoader()));
    }
View Full Code Here

        // other instance is hotswapped
        Foo bFoo = new Foo();
        bFoo.sayHello();

        ClassPool cp2 = new ClassPool(null);
        cp2.appendClassPath(new LoaderClassPath(Foo.class.getClassLoader()));

        try {
            // swap java.lang.ClassLoader with itself
            cp2.writeFile("java.lang.ClassLoader", "_dump");
            //byte[] bytecode = ClassLoaderPatcher.getPatchedClassLoader("org.codehaus.aspectwerkz.hook.impl.ClassLoaderPreProcessorImpl");
View Full Code Here

     */
    public static CtClass fromByte(final String name, final byte[] bytecode, final ClassLoader loader) {
        try {
            ClassPool cp = new ClassPool(null);
            cp.insertClassPath(new ByteArrayClassPath(name, bytecode));
            cp.appendClassPath(new LoaderClassPath(loader));
            return cp.get(name);
        }
        catch (Exception e) {
            throw new WrappedRuntimeException(e);
        }
View Full Code Here

      Class wrapperType;
      try
      {
         ClassPool pool = new ClassPool(true);
         pool.appendClassPath(new LoaderClassPath(loader));
         CtClass clazz = pool.makeClass(wrapperName);
         clazz.setSuperclass(pool.get(WrapperType.class.getName()));

         for (WrappedParameter param : wrappedParameters)
         {
View Full Code Here

    if (clazzProxy == null) {

      ClassPool pool = new ClassPool();
      CtClass ctChieldClass = pool.getOrNull(chieldClassName);

      pool.appendClassPath(new LoaderClassPath(classLoader));
      CtClass ctSuperClass = pool.get(superClassName);

      ctChieldClass = pool.getAndRename(ConfigurationImpl.class.getCanonicalName(), chieldClassName);
      ctChieldClass.setSuperclass(ctSuperClass);
View Full Code Here

TOP

Related Classes of javassist.LoaderClassPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.