Package javassist

Examples of javassist.ClassClassPath


     */
    public MockClassLoader(String[] classesToMock, String[] packagesToDefer, UseClassPathAdjuster useClassPathAdjuster) {
        super(MockClassLoader.class.getClassLoader(), getPackagesToDefer(packagesToDefer));

        addClassesToModify(classesToMock);
        classPool.appendClassPath(new ClassClassPath(this.getClass()));
        if (useClassPathAdjuster != null) {
            try {
                Class<? extends ClassPathAdjuster> value = useClassPathAdjuster.value();
                ClassPathAdjuster classPathAdjuster = value.newInstance();
                classPathAdjuster.adjustClassPath(classPool);
View Full Code Here


      ClassLoader tccl = Thread.currentThread().getContextClassLoader();
      ClassLoader cherryPickCl = new CherryPickClassLoader(included, null, tccl);
      Thread.currentThread().setContextClassLoader(cherryPickCl);
      ClassPool pool = ClassPool.getDefault();
      // Insert a classpath so that Maven does not complain about not finding the class
      pool.insertClassPath(new ClassClassPath(Car.class));
      CtClass carCt = pool.get(CAR);
      try {
         carCt.addField(CtField.make("public int year;", carCt));
         Class carClass = carCt.toClass();
         if (isNewExternalizer) {
View Full Code Here

    Method method =null;
    try {
      ClassPool pool = ClassPool.getDefault();
     
     
      pool.insertClassPath(new ClassClassPath(clazz));

      CtClass cc = pool.get(clazz.getName());
     
      //DEBUG, 函数名相同的方法重载的信息读不到 2011-03-21
      CtMethod cm = cc.getDeclaredMethod(method.getName());
View Full Code Here

 
  @SuppressWarnings("unchecked")
  private MethodProxy _getMethodProxy(Method method) throws Throwable {
//    long start = System.currentTimeMillis();
    ClassPool classPool = ClassPool.getDefault();
    classPool.insertClassPath(new ClassClassPath(MethodProxy.class));
    classPool.importPackage(Method.class.getCanonicalName());
   
    CtClass cc = classPool.makeClass("com.firefly.utils.ProxyMethod" + UUID.randomUUID().toString().replace("-", ""));
   
    cc.addInterface(classPool.get(MethodProxy.class.getName()));
View Full Code Here

 
  @SuppressWarnings("unchecked")
  private FieldProxy _getFieldProxy(Field field) throws Throwable {
//    long start = System.currentTimeMillis();
    ClassPool classPool = ClassPool.getDefault();
    classPool.insertClassPath(new ClassClassPath(FieldProxy.class));
    classPool.importPackage(Field.class.getCanonicalName());
   
    CtClass cc = classPool.makeClass("com.firefly.utils.ProxyField" + UUID.randomUUID().toString().replace("-", ""));
    cc.addInterface(classPool.get(FieldProxy.class.getName()));
    cc.addField(CtField.make("private Field field;", cc));
View Full Code Here

 
  @SuppressWarnings("unchecked")
  private ArrayProxy _getArrayProxy(Class<?> clazz) throws Throwable {
//    long start = System.currentTimeMillis();
    ClassPool classPool = ClassPool.getDefault();
    classPool.insertClassPath(new ClassClassPath(ArrayProxy.class));
   
    CtClass cc = classPool.makeClass("com.firefly.utils.ArrayField" + UUID.randomUUID().toString().replace("-", ""));
    cc.addInterface(classPool.get(ArrayProxy.class.getName()));
   
    cc.addMethod(CtMethod.make(createArraySizeCode(clazz), cc));
View Full Code Here

   * @throws NotFoundException
   */
  public static Class getValueClassByClassName(String vidClass,
      String vdataClass, String edataClass) throws CannotCompileException,
      NotFoundException {
    pool.insertClassPath(new ClassClassPath(PreprocessJobValueFactory.class));
    CtClass ctVal = pool.get(VertexEdgeUnionType.class.getName());
    ctVal.setName("generatedclass.MyPreprocessJobValue" + id);
    CtClass ctSuper = pool.get(VertexEdgeUnionType.class.getName());
    id++;
    ctVal.setSuperclass(ctSuper);
View Full Code Here

   * @throws CannotCompileException
   * @throws NotFoundException
   */
  public static Class getValueClassByClassName(String vidClass,
      String edataClass) throws CannotCompileException, NotFoundException {
    pool.insertClassPath(new ClassClassPath(
        EdgeTransformJobValueFactory.class));
    CtClass ctVal = pool.get(PairListType.class.getName());
    ctVal.setName("generatedclass.MyEdgeTransformJobValue" + id);
    CtClass ctSuper = pool.get(PairListType.class.getName());
    id++;
View Full Code Here

public class IngressJobKeyValueFactory {
  private static ClassPool pool = ClassPool.getDefault();

  public static Class getKeyClassByClassName(String vidClassName)
      throws NotFoundException, CannotCompileException {
    pool.insertClassPath(new ClassClassPath(IngressJobKeyValueFactory.class));
    CtClass ctKey = pool.get(IngressKeyType.class.getName());
    ctKey.setName("generatedclass.MyIngressJobKey" + keyid);
    keyid++;
    CtClass ctSuper = pool.get(IngressKeyType.class.getName());
    ctKey.setSuperclass(ctSuper);
View Full Code Here

  }

  public static Class getValueClassByClassName(String vidClassName,
      String vdataClassName, String edataClassName)
      throws CannotCompileException, NotFoundException {
    pool.insertClassPath(new ClassClassPath(IngressJobKeyValueFactory.class));

    // Create a new value class and bind with the new factory.
    CtClass ctVal = pool.get(IngressValueType.class.getName());
    ctVal.setName("generatedclass.MyIngressJobVal" + valid);
    CtClass ctSuper = pool.get(IngressValueType.class.getName());
View Full Code Here

TOP

Related Classes of javassist.ClassClassPath

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.