Package com.thoughtworks.paranamer

Examples of com.thoughtworks.paranamer.BytecodeReadingParanamer$ClassReader


        }
        return 0;
    }

    private static Param[] getParameters(final Method method) {
        final Paranamer paranamer = new CachingParanamer(new BytecodeReadingParanamer());
        final String[] paramNames = paranamer.lookupParameterNames(method, false);
        final Type[]   types      = method.getGenericParameterTypes();
        final Param[]  params     = new Param[types.length];
        for (int i = 0; i < types.length; i++) {
            params[i] = new Param(paramNames[i], types[i]);
View Full Code Here


        }

        //
        // Build Parameter Infos
        // Extract parameter names from debug symbols
        Paranamer paranamer = new BytecodeReadingParanamer();
        String[] parameterNames = paranamer.lookupParameterNames(concreteMethod);
        Class<?>[] types = concreteMethod.getParameterTypes();

        // Parameter annotations used form descriptor come from the annotated method, not the public method
        Annotation[][] parameterAnnotations;
        if (annotatedMethod != null) {
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();
    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

   */
  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);
        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

TOP

Related Classes of com.thoughtworks.paranamer.BytecodeReadingParanamer$ClassReader

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.