Package org.springframework.asm

Examples of org.springframework.asm.ClassReader


            + "] - unable to determine constructors/methods parameter names");
      }
      return NO_DEBUG_INFO_MAP;
    }
    try {
      ClassReader classReader = new ClassReader(is);
      Map<Member, String[]> map = new ConcurrentHashMap<Member, String[]>(32);
      classReader.accept(new ParameterNameDiscoveringVisitor(clazz, map), 0);
      return map;
    }
    catch (IOException ex) {
      if (logger.isDebugEnabled()) {
        logger.debug("Exception thrown while reading '.class' file for class [" + clazz
View Full Code Here


  private final AnnotationMetadata annotationMetadata;


  SimpleMetadataReader(Resource resource, ClassLoader classLoader) throws IOException {
    InputStream is = new BufferedInputStream(resource.getInputStream());
    ClassReader classReader = null;
    try {
      classReader = new ClassReader(is);
    }
    finally {
      is.close();
    }

    AnnotationMetadataReadingVisitor visitor = new AnnotationMetadataReadingVisitor(classLoader);
    classReader.accept(visitor, ClassReader.SKIP_DEBUG);

    this.annotationMetadata = visitor;
    // (since AnnotationMetadataReader extends ClassMetadataReadingVisitor)
    this.classMetadata = visitor;
    this.resource = resource;
View Full Code Here

  SimpleMetadataReader(Resource resource, ClassLoader classLoader) throws IOException {
    this.resource = resource;
    InputStream is = this.resource.getInputStream();
    try {
      this.classReader = new ClassReader(is);
    }
    finally {
      is.close();
    }
    this.classLoader = classLoader;
View Full Code Here

  /**
   * Visit the given method and discover its parameter names.
   */
  private ParameterNameDiscoveringVisitor visitMethod(Method method) throws IOException {
    ClassReader classReader = getClassReader(method.getDeclaringClass());
    FindMethodParameterNamesClassVisitor classVisitor = new FindMethodParameterNamesClassVisitor(method);
    classReader.accept(classVisitor, false);
    return classVisitor;
  }
View Full Code Here

  /**
   * Visit the given constructor and discover its parameter names.
   */
  private ParameterNameDiscoveringVisitor visitConstructor(Constructor ctor) throws IOException {
    ClassReader classReader = getClassReader(ctor.getDeclaringClass());
    FindConstructorParameterNamesClassVisitor classVisitor = new FindConstructorParameterNamesClassVisitor(ctor);
    classReader.accept(classVisitor, false);
    return classVisitor;
  }
View Full Code Here

  /**
   * Obtain a (cached) ClassReader for the given class.
   */
  private ClassReader getClassReader(Class clazz) throws IOException {
    synchronized (this.classReaderCache) {
      ClassReader classReader = (ClassReader) this.classReaderCache.get(clazz);
      if (classReader == null) {
        InputStream is = clazz.getResourceAsStream(ClassUtils.getClassFileName(clazz));
        if (is == null) {
          throw new FileNotFoundException("Class file for class [" + clazz.getName() + "] not found");
        }
        try {
          classReader = new ClassReader(is);
          this.classReaderCache.put(clazz, classReader);
        }
        finally {
          is.close();
        }
View Full Code Here

            "] - unable to determine constructor/method parameter names");
      }
      return NO_DEBUG_INFO_MAP;
    }
    try {
      ClassReader classReader = new ClassReader(is);
      Map<Member, String[]> map = new ConcurrentHashMap<Member, String[]>(32);
      classReader.accept(new ParameterNameDiscoveringVisitor(clazz, map), 0);
      return map;
    }
    catch (IOException ex) {
      if (logger.isDebugEnabled()) {
        logger.debug("Exception thrown while reading '.class' file for class [" + clazz +
View Full Code Here

  private final ClassMetadata classMetadata;
  private final AnnotationMetadata annotationMetadata;

  SimpleMetadataReader(Resource resource, ClassLoader classLoader) throws IOException {
    InputStream is = resource.getInputStream();
    ClassReader classReader = null;
    try {
      classReader = new ClassReader(is);
    } finally {
      is.close();
    }

    AnnotationMetadataReadingVisitor visitor = new AnnotationMetadataReadingVisitor(classLoader);
    classReader.accept(visitor, true);
   
    this.annotationMetadata = visitor;
    // (since AnnotationMetadataReader extends ClassMetadataReadingVisitor)
    this.classMetadata = visitor;
    this.resource = resource;
View Full Code Here

            + "] - unable to determine constructors/methods parameter names");
      }
      return NO_DEBUG_INFO_MAP;
    }
    try {
      ClassReader classReader = new ClassReader(is);
      Map<Member, String[]> map = new ConcurrentHashMap<Member, String[]>();
      classReader.accept(new ParameterNameDiscoveringVisitor(clazz, map), false);
      return map;
    }
    catch (IOException ex) {
      if (logger.isDebugEnabled()) {
        logger.debug("Exception thrown while reading '.class' file for class [" + clazz
View Full Code Here

    return classEntries;
  }

  private static boolean isMainClass(InputStream inputStream) {
    try {
      ClassReader classReader = new ClassReader(inputStream);
      MainMethodFinder mainMethodFinder = new MainMethodFinder();
      classReader.accept(mainMethodFinder, ClassReader.SKIP_CODE);
      return mainMethodFinder.isFound();
    }
    catch (IOException ex) {
      return false;
    }
View Full Code Here

TOP

Related Classes of org.springframework.asm.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.