Package javassist

Examples of javassist.ClassPool.makeClass()


      ClassPool pool = ClassPool.getDefault();
     
      // TOMCAT and JBOSS classloader handling
      pool.insertClassPath(new ClassClassPath(clazz));
     
      CtClass proxyClass = pool.makeClass(proxyClassName);
     
    //  Add proxy inheritance
    //
      proxyClass.setSuperclass(pool.get(sourceClassName));
     
View Full Code Here


            } else if (fullNames.containsKey(extend)) {
                extendClass = fullNames.get(extend);
            } else {
                extendClass = ClassUtils.forName(packages, extend).getName();
            }
            cls = pool.makeClass(name, pool.get(extendClass));
        } else {
            cls = pool.makeClass(name);
        }
        matcher = IMPLEMENTS_PATTERN.matcher(source);
        if (matcher.find()) {
View Full Code Here

            } else {
                extendClass = ClassUtils.forName(packages, extend).getName();
            }
            cls = pool.makeClass(name, pool.get(extendClass));
        } else {
            cls = pool.makeClass(name);
        }
        matcher = IMPLEMENTS_PATTERN.matcher(source);
        if (matcher.find()) {
            String[] ifaces = matcher.group(1).trim().split("\\,");
            for (String iface : ifaces) {
View Full Code Here

      ClassPool global = null;
      try
      {
         final String classname = CLASS_A + "XYZ";
         global = createClassPool("A", true, JAR_A_1);
         CtClass newCtClass = global.makeClass(classname);
         Class<?> newClass = newCtClass.toClass();
         Class<?> foundClass = global.getClassLoader().loadClass(classname);
         assertSame(newClass, foundClass);
      }
      finally
View Full Code Here

         Class<?> newClassA = newCtClassA.toClass();
         assertSame(globalA.getClassLoader(), newClassA.getClassLoader());
         assertSame(newClassA, globalA.getClassLoader().loadClass(classnameA));
         assertSame(newClassA, globalB.getClassLoader().loadClass(classnameA));

         CtClass newCtClassB = globalB.makeClass(classnameB);
         Class<?> newClassB = newCtClassB.toClass();
         assertSame(globalB.getClassLoader(), newClassB.getClassLoader());
         assertSame(newClassB, globalA.getClassLoader().loadClass(classnameB));
         assertSame(newClassB, globalB.getClassLoader().loadClass(classnameB));
      }
View Full Code Here

         Class<?> newClassA = newCtClassA.toClass();
         assertSame(globalA.getClassLoader(), newClassA.getClassLoader());
         assertSame(newClassA, globalA.getClassLoader().loadClass(classnameA));
         assertSame(newClassA, globalB.getClassLoader().loadClass(classnameA));

         CtClass newCtClassB = globalB.makeClass(classnameB);
         Class<?> newClassB = newCtClassB.toClass();
         assertSame(globalB.getClassLoader(), newClassB.getClassLoader());
         assertSame(newClassB, globalA.getClassLoader().loadClass(classnameB));
         assertSame(newClassB, globalB.getClassLoader().loadClass(classnameB));
      }
View Full Code Here

         assertCannotLoadCtClass(child2, parentName);
         assertCannotLoadCtClass(child2, childName);
        
         CtClass parentClass = global.makeClass(parentName);
        
         CtClass childClass = child2.makeClass(childName);
         childClass.setSuperclass(parentClass);
        
         CtClass parentFromGlobal = global.get(parentName);
         assertSame(global, parentFromGlobal.getClassPool());
         assertSame(parentClass, parentFromGlobal);
View Full Code Here

         assertCannotLoadCtClass(child, PARENT);
         assertCannotLoadCtClass(child, CHILD);
        
         CtClass parentClass = parent.makeClass(PARENT);
        
         CtClass childClass = child.makeClass(CHILD);
         childClass.setSuperclass(parentClass);
        
         CtClass parentFromParent = parent.get(PARENT);
         assertSame(parent, parentFromParent.getClassPool());
         assertSame(parentClass, parentFromParent);
View Full Code Here

            } else if (fullNames.containsKey(extend)) {
                extendClass = fullNames.get(extend);
            } else {
                extendClass = ClassUtils.forName(packages, extend).getName();
            }
            cls = pool.makeClass(name, pool.get(extendClass));
        } else {
            cls = pool.makeClass(name);
        }
        matcher = IMPLEMENTS_PATTERN.matcher(source);
        if (matcher.find()) {
View Full Code Here

            } else {
                extendClass = ClassUtils.forName(packages, extend).getName();
            }
            cls = pool.makeClass(name, pool.get(extendClass));
        } else {
            cls = pool.makeClass(name);
        }
        matcher = IMPLEMENTS_PATTERN.matcher(source);
        if (matcher.find()) {
            String[] ifaces = matcher.group(1).trim().split("\\,");
            for (String iface : ifaces) {
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.