Examples of toClass()


Examples of javassist.CtClass.toClass()

            attr = filterExistingAnnotations(add, method);
            addNewAnnotations(add, method, constpool, pool, attr);
        }
        cc.setName(cc.getName() + "$ClassModifier$" + COUNTER.increment());
        cc.setSuperclass(pool.get(clazz.getCanonicalName()));
        return cc.toClass();
    }

    private static CtClass getType(Object value, Class<?> valueType, ClassPool classPool) throws NotFoundException
    {
        if (value instanceof Boolean) {
View Full Code Here

Examples of javassist.CtClass.toClass()

                pcClass.addMethod(setContainerInstance);
               
                CtMethod createContainerInstance = CtMethod.make("public static org.rhq.core.pc.PluginContainer getContainerInstance(java.lang.String name) { org.rhq.core.pc.PluginContainer inst = (org.rhq.core.pc.PluginContainer) INSTANCES.get(name); if (inst == null) { inst = new org.rhq.core.pc.PluginContainer(); INSTANCES.put(name, inst);} return inst;}", pcClass);
                pcClass.addMethod(createContainerInstance);
               
                pcClass.toClass(cl, null);
            } catch (Exception e) {
                throw new IllegalStateException("Could not enhance the PluginContainer class", e);
            } finally {
                initialized = true;
            }
View Full Code Here

Examples of javassist.CtClass.toClass()

            } catch (ClassNotFoundException e) {
                LOG.debug("Class [" + simplifiedName + "] not found - cause: " + e, e);
                if (cached != null) {
                    // strange - we found the class definition in the class pool, which means we must have touched it
                    // before but Class.forName failed to find the class in the class pool's class loader.
                    return cached.toClass();
                }
            }

            CtClass originalClass = classPool.get(intf.getName());
            ClassFile originalClassFile = originalClass.getClassFile();
View Full Code Here

Examples of javassist.CtClass.toClass()

                //it is important to add the method directly to the classfile, not the class
                //because otherwise the generics info wouldn't survive
                newClassFile.addMethod(newMethod.getMethodInfo());
            }

            return newClass.toClass();

        } catch (Exception e) {
            String msg = "Failed to simplify " + intf + ".";
            LOG.error(msg, e);
            throw new IllegalStateException(msg, e);
View Full Code Here

Examples of javassist.CtClass.toClass()

                    customClass.addMethod(method);
                }
            }

            return customClass.toClass();
        } catch (NotFoundException e) {
            LOG.error("Could not create custom interface for resource with id " + proxy.getId(), e);
            throw new IllegalStateException("Could not create custom interface for resource with id " + proxy.getId(), e);
        } catch (CannotCompileException e) {
            LOG.error("Could not create custom interface for resource with id " + proxy.getId(), e);
View Full Code Here

Examples of javassist.CtClass.toClass()

      ClassPoolDomain child = createClassPoolDomain("CHILD", parent, false);
      ClassPool childPool = createDelegatingClassPool(child, JAR_A);
      CtClass parentClazz = TransformerCommon.makeClass(parentPool, "test.Test");
      assertSame(parentClazz, parentPool.get("test.Test"));
      assertSame(parentPool, parentClazz.getClassPool());
      Class<?> parentClass = parentClazz.toClass();
      assertSame(parentPool.getClassLoader(), parentClass.getClassLoader());
     
      CtClass childClazz = TransformerCommon.makeClass(childPool, "test.Test");
      assertSame(childClazz, childPool.get("test.Test"));
      assertSame(childPool, childClazz.getClassPool());
View Full Code Here

Examples of javassist.CtClass.toClass()

      assertSame(parentPool.getClassLoader(), parentClass.getClassLoader());
     
      CtClass childClazz = TransformerCommon.makeClass(childPool, "test.Test");
      assertSame(childClazz, childPool.get("test.Test"));
      assertSame(childPool, childClazz.getClassPool());
      Class<?> childClass = childClazz.toClass();
      assertSame(childPool.getClassLoader(), childClass.getClassLoader());
   }

   public void testGenerateSameNestedClassInChildAndParent() throws Exception
   {
View Full Code Here

Examples of javassist.CtClass.toClass()

      ClassPoolDomain child = createClassPoolDomain("CHILD", parent, false);
      ClassPool childPool = createDelegatingClassPool(child, JAR_A);
      CtClass parentA = parentPool.get(CLASS_A);
      CtClass parentClazz = TransformerCommon.makeNestedClass(parentA, "Test", true);
      assertSame(parentPool, parentClazz.getClassPool());
      Class<?> parentClass = parentClazz.toClass();
      assertSame(parentPool.getClassLoader(), parentClass.getClassLoader());
      Class<?> parentAClass = parentA.toClass();
      assertSame(parentPool.getClassLoader(), parentAClass.getClassLoader());
     
      CtClass childA = childPool.get(CLASS_A);
View Full Code Here

Examples of javassist.CtClass.toClass()

      assertSame(parentPool.getClassLoader(), parentAClass.getClassLoader());
     
      CtClass childA = childPool.get(CLASS_A);
      CtClass childClazz = TransformerCommon.makeNestedClass(childA, "Test", true);
      assertSame(childPool, childClazz.getClassPool());
      Class<?> childClass = childClazz.toClass();
      assertSame(childPool.getClassLoader(), childClass.getClassLoader());
      Class<?> childAClass = childA.toClass();
      assertSame(childPool.getClassLoader(), childAClass.getClassLoader());
   }
View Full Code Here

Examples of javassist.CtClass.toClass()

      ClassPoolDomain child = createClassPoolDomain("CHILD", parent, true);
      ClassPool childPool = createDelegatingClassPool(child, JAR_A);
      CtClass parentA = parentPool.get(CLASS_A);
      CtClass parentClazz = TransformerCommon.makeNestedClass(parentA, "Test", true);
      assertSame(parentPool, parentClazz.getClassPool());
      Class<?> parentClass = parentClazz.toClass();
      assertSame(parentPool.getClassLoader(), parentClass.getClassLoader());
      Class<?> parentAClass = parentA.toClass();
      assertSame(parentPool.getClassLoader(), parentAClass.getClassLoader());
     
      CtClass childA = childPool.get(CLASS_A);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.