Package org.objectweb.asm

Examples of org.objectweb.asm.ClassAdapter


  protected byte[] transform(final ClassReader reader,
      final ClassProcessingParticipant[] subjectOfInterest) {
    ClassWriter cv = new ClassWriter(ClassWriter.COMPUTE_FRAMES
        | ClassWriter.COMPUTE_MAXS);
    reader.accept(new ClassAdapter(cv) {

     
      public void visit(int version, int access, String name,
          String signature, String superName, String[] interfaces) {
        super.visit(version, access, name, signature, superName, interfaces);
View Full Code Here


                throw new ReaderException("could not retrieve the bytecode from the bytecode provider [" + AnnotationReader.BYTECODE_PROVIDER.getClass().getName() + "]", e);
            }
            ClassReader cr = new ClassReader(bytes);
            ClassWriter cw = new ClassWriter(false, true);
            cr.accept(
                    new ClassAdapter(cw) {
                        public MethodVisitor visitMethod(int access, final String name, String desc, String signature, String[] exceptions) {
                            return new MethodAdapter(super.visitMethod(access, name, desc, signature, exceptions)) {
                                public AnnotationVisitor visitAnnotationDefault() {
                                    return new DefaultAnnotationBuilderVisitor(newDefaults, name);
                                }
View Full Code Here

    public Object[] getClassAttributes() {
        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List classAttributes = new ArrayList();
        m_reader.accept(new ClassAdapter(m_writer) {
            public void visitAttribute(final Attribute attribute) {
                //TODO - waiting ASM feedback on that instead of several call to visitAtribute from ASM
                //Attribute current = attribute;
                //while (current != null) {
                if (attribute instanceof CustomAttribute) {
View Full Code Here

    public Object[] getMethodAttributes(final String methodName, final String[] methodParamTypes) {
        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List methodAttributes = new ArrayList();
        m_reader.accept(new ClassAdapter(m_writer) {
            public CodeVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
                final String[] exceptions,
View Full Code Here

    public Object[] getConstructorAttributes(final String[] constructorParamTypes) {
        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List methodAttributes = new ArrayList();
        m_reader.accept(new ClassAdapter(m_writer) {
            public CodeVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
                final String[] exceptions,
View Full Code Here

    public Object[] getFieldAttributes(final String fieldName) {
        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List fieldAttributes = new ArrayList();
        m_reader.accept(new ClassAdapter(m_writer) {
            public void visitField(
                final int access,
                final String name,
                final String desc,
                final Object value,
View Full Code Here

    final AClass owner = AClassFactory.getProductClass(clazz);
    InputStream classStream = ASMClassLoader.asmClassLoader.getResourceAsStream(clazz.getName().replace('.', '/') + ".class");
    ClassReader cr = new ClassReader(classStream);
    final List<MethodEntity> list = new ArrayList<MethodEntity>();
   
    cr.accept(new ClassAdapter(new EmptyVisitor()){

      @Override
      public MethodVisitor visitMethod(int access, String name,
          String desc, String signature, String[] exceptions) {
        if((StringUtils.isEmpty(findName) || name.equals(findName))){
View Full Code Here

   */
  public static byte[] instrument(final byte[] source,
      final String accessFieldName) {
    final ClassReader reader = new ClassReader(source);
    final ClassWriter writer = new ClassWriter(reader, 0);
    reader.accept(new ClassAdapter(writer) {

      @Override
      public void visitEnd() {
        createDataField(cv, accessFieldName);
        super.visitEnd();
View Full Code Here

   */
  public static byte[] instrument(final byte[] source,
      final String accessFieldName) {
    final ClassReader reader = new ClassReader(source);
    final ClassWriter writer = new ClassWriter(reader, 0);
    reader.accept(new ClassAdapter(writer) {

      @Override
      public void visitEnd() {
        createDataField(cv, accessFieldName);
        super.visitEnd();
View Full Code Here

   */
  public static byte[] instrument(final byte[] source,
      final String accessFieldName) {
    final ClassReader reader = new ClassReader(source);
    final ClassWriter writer = new ClassWriter(reader, 0);
    reader.accept(new ClassAdapter(writer) {

      @Override
      public void visitEnd() {
        createDataField(cv, accessFieldName);
        super.visitEnd();
View Full Code Here

TOP

Related Classes of org.objectweb.asm.ClassAdapter

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.