Package jodd.asm5

Examples of jodd.asm5.ClassVisitor


   */
  private ClassReader getCachedAdviceClassReader(Class<? extends ProxyAdvice> advice) {
    if (adviceClassReaderCache == null) {
      adviceClassReaderCache = new HashMap<Class<? extends ProxyAdvice>, ClassReader>();
    }
    ClassReader adviceReader = adviceClassReaderCache.get(advice);
    if (adviceReader == null) {
      adviceReader = createAdviceClassReader(advice);
      adviceClassReaderCache.put(advice, adviceReader);
    }
    return adviceReader;
View Full Code Here


    List<String> superList = new ArrayList<String>();
    // check all public super methods that are not overridden in superclass
    while (nextSupername != null) {
      InputStream inputStream = null;
      ClassReader cr = null;
      try {
        inputStream = ClassLoaderUtil.getClassAsStream(nextSupername);
        cr = new ClassReader(inputStream);
      } catch (IOException ioex) {
        throw new ProxettaException("Unable to inspect super class: " + nextSupername, ioex);
      } finally {
        StreamUtil.close(inputStream);
      }
      hierarchyLevel++;
      superList.add(nextSupername);
      superClassReaders.add(cr)// remember the super class reader
      cr.accept(new SuperClassVisitor(), 0);
    }
    superClasses = superList.toArray(new String[superList.size()]);

    // check all interface methods that are not overridden in super-interface
    if (nextInterfaces != null) {
      while (!nextInterfaces.isEmpty()) {
        Iterator<String> iterator = nextInterfaces.iterator();
        String next = iterator.next();
        iterator.remove();

        InputStream inputStream = null;
        ClassReader cr = null;
        try {
          inputStream = ClassLoaderUtil.getClassAsStream(next);
          cr = new ClassReader(inputStream);
        } catch (IOException ioex) {
          throw new ProxettaException("Unable to inspect super interface: " + next, ioex);
        } finally {
          StreamUtil.close(inputStream);
        }
        hierarchyLevel++;
        superClassReaders.add(cr);        // remember the super class reader
        cr.accept(new SuperClassVisitor(), 0);
      }
    }

  }
View Full Code Here

    if (stream == null) {
      throw new ParamoException("Class not found: " + declaringClass);
    }

    try {
      ClassReader reader = new ClassReader(stream);
      MethodFinder visitor = new MethodFinder(declaringClass, name, paramTypes);
      reader.accept(visitor, 0);
      return visitor.getResolvedParameters();
    } catch (IOException ioex) {
      throw new ParamoException(ioex);
    }
  }
View Full Code Here

   */
  private ClassReader createAdviceClassReader(Class<? extends ProxyAdvice> advice) {
    InputStream inputStream = null;
    try {
      inputStream = ClassLoaderUtil.getClassAsStream(advice);
      return new ClassReader(inputStream);
    } catch (IOException ioex) {
      throw new ProxettaException(ioex);
    } finally {
      StreamUtil.close(inputStream);
    }
View Full Code Here

   */
  private ClassReader getCachedAdviceClassReader(Class<? extends ProxyAdvice> advice) {
    if (adviceClassReaderCache == null) {
      adviceClassReaderCache = new HashMap<Class<? extends ProxyAdvice>, ClassReader>();
    }
    ClassReader adviceReader = adviceClassReaderCache.get(advice);
    if (adviceReader == null) {
      adviceReader = createAdviceClassReader(advice);
      adviceClassReaderCache.put(advice, adviceReader);
    }
    return adviceReader;
View Full Code Here

    List<String> superList = new ArrayList<String>();
    // check all public super methods that are not overridden in superclass
    while (nextSupername != null) {
      InputStream inputStream = null;
      ClassReader cr = null;
      try {
        inputStream = ClassLoaderUtil.getClassAsStream(nextSupername, classLoader);
        cr = new ClassReader(inputStream);
      } catch (IOException ioex) {
        throw new ProxettaException("Unable to inspect super class: " + nextSupername, ioex);
      } finally {
        StreamUtil.close(inputStream);
      }
      hierarchyLevel++;
      superList.add(nextSupername);
      superClassReaders.add(cr)// remember the super class reader
      cr.accept(new SuperClassVisitor(), 0);
    }
    superClasses = superList.toArray(new String[superList.size()]);

    // check all interface methods that are not overridden in super-interface
    if (nextInterfaces != null) {
      while (!nextInterfaces.isEmpty()) {
        Iterator<String> iterator = nextInterfaces.iterator();
        String next = iterator.next();
        iterator.remove();

        InputStream inputStream = null;
        ClassReader cr = null;
        try {
          inputStream = ClassLoaderUtil.getClassAsStream(next, classLoader);
          cr = new ClassReader(inputStream);
        } catch (IOException ioex) {
          throw new ProxettaException("Unable to inspect super interface: " + next, ioex);
        } finally {
          StreamUtil.close(inputStream);
        }
        hierarchyLevel++;
        superClassReaders.add(cr);        // remember the super class reader
        cr.accept(new SuperClassVisitor(), 0);
      }
    }

  }
View Full Code Here

  protected void process() {
    if (targetInputStream == null) {
      throw new ProxettaException("Target missing");
    }
    // create class reader
    ClassReader classReader;
    try {
      classReader = new ClassReader(targetInputStream);
    } catch (IOException ioex) {
      throw new ProxettaException("Error reading class input stream", ioex);
    }

    // reads information
    TargetClassInfoReader targetClassInfoReader = new TargetClassInfoReader(proxetta.getClassLoader());
    classReader.accept(targetClassInfoReader, 0);

    this.destClassWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);

    // create proxy
    if (log.isDebugEnabled()) {
      log.debug("processing: " + classReader.getClassName());
    }
    WorkData wd = process(classReader, targetClassInfoReader);

    // store important data
    proxyApplied = wd.proxyApplied;
View Full Code Here

    // reads information
    TargetClassInfoReader targetClassInfoReader = new TargetClassInfoReader();
    classReader.accept(targetClassInfoReader, 0);

    this.destClassWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);

    // create proxy
    if (log.isDebugEnabled()) {
      log.debug("processing: " + classReader.getClassName());
    }
View Full Code Here

    // reads information
    TargetClassInfoReader targetClassInfoReader = new TargetClassInfoReader(proxetta.getClassLoader());
    classReader.accept(targetClassInfoReader, 0);

    this.destClassWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);

    // create proxy
    if (log.isDebugEnabled()) {
      log.debug("processing: " + classReader.getClassName());
    }
View Full Code Here

    }

    // create new field wrapper field and store it's reference into work-data
    wd.wrapperRef = targetFieldName;
    wd.wrapperType = 'L' + name + ';';
    FieldVisitor fv  = wd.dest.visitField(AsmUtil.ACC_PUBLIC, wd.wrapperRef, wd.wrapperType, null, null);
    fv.visitEnd();

    createEmptyCtor();
  }
View Full Code Here

TOP

Related Classes of jodd.asm5.ClassVisitor

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.