Package org.objectweb.asm

Examples of org.objectweb.asm.FieldVisitor


    return null;
  }
 
  private void injectProfilerStubs(ClassMetadata meta) {
    cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
    FieldVisitor fv = cw.visitField(ACC_PRIVATE|ACC_FINAL, "$profiler", meta.profilerClass.getDescriptor(), null, null);
    fv.visitEnd();

    if (!meta.foundInitialize)
      ClassUtil.injectMethodStub(cw, "initialize");
    if (!meta.foundBegin)
      ClassUtil.injectMethodStub(cw, "begin");
View Full Code Here


            return null;
        }
    }
    private static Class<?> createNamespaceWrapperInternal(ASMHelper helper, ClassWriter cw) {
        String className = "org.apache.cxf.jaxb.NamespaceMapperInternal";
        FieldVisitor fv;
        MethodVisitor mv;
        cw.visit(Opcodes.V1_5,
                 Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
                 "org/apache/cxf/jaxb/NamespaceMapperInternal", null,
                 "com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper", null);

        cw.visitSource("NamespaceMapper.java", null);

        fv = cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL,
                           "nspref", "Ljava/util/Map;",
                           "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;", null);
        fv.visitEnd();
       
        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>",
                            "(Ljava/util/Map;)V",
                            "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;)V", null);
        mv.visitCode();
View Full Code Here

            return null;
        }
    }
    private static Class<?> createNamespaceWrapperInternal(ASMHelper helper, ClassWriter cw) {
        String className = "org.apache.cxf.jaxb.NamespaceMapperInternal";
        FieldVisitor fv;
        MethodVisitor mv;
        cw.visit(Opcodes.V1_5,
                 Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
                 "org/apache/cxf/jaxb/NamespaceMapperInternal", null,
                 "com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper", null);

        cw.visitSource("NamespaceMapper.java", null);

        fv = cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL,
                           "nspref", "Ljava/util/Map;",
                           "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;", null);
        fv.visitEnd();
       
        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>",
                            "(Ljava/util/Map;)V",
                            "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;)V", null);
        mv.visitCode();
View Full Code Here

            return null;
        }
    }
    private static Class<?> createNamespaceWrapperInternal(ASMHelper helper, ClassWriter cw) {
        String className = "org.apache.cxf.jaxb.NamespaceMapperInternal";
        FieldVisitor fv;
        MethodVisitor mv;
        cw.visit(Opcodes.V1_5,
                 Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
                 "org/apache/cxf/jaxb/NamespaceMapperInternal", null,
                 "com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper", null);

        cw.visitSource("NamespaceMapper.java", null);

        fv = cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL,
                           "nspref", "Ljava/util/Map;",
                           "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;", null);
        fv.visitEnd();
       
        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>",
                            "(Ljava/util/Map;)V",
                            "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;)V", null);
        mv.visitCode();
View Full Code Here

    for (Map.Entry<String, ExtFun> ent : imported.entrySet()) {
      String field_name = ent.getKey();
      ExtFun f = ent.getValue();

      FieldVisitor fv = cv.visitField(ACC_STATIC, ent.getKey(), "L"
          + EFUN_NAME + f.arity + ";", null, null);
      EFunCG.ensure(f.arity);
      AnnotationVisitor av = fv.visitAnnotation(
          IMPORT_ANN_TYPE.getDescriptor(), true);
      av.visit("module", f.mod.getName());
      av.visit("fun", f.fun.getName());
      av.visit("arity", f.arity);
      av.visitEnd();
      fv.visitEnd();
    }
   
    generate_on_load();

    generate_classinit();
View Full Code Here

    for (Map.Entry<BitSet,String> ent : bitsets.entrySet()) {
      BitSet bs = ent.getKey();
      String name = ent.getValue();
     
      FieldVisitor fv = cv.visitField(ACC_STATIC, name, Type.getDescriptor(BitSet.class), null, null);
      fv.visitEnd();
     
      byte[] bytes = bs.toByteArray();
      mv.visitLdcInsn(new String(bytes, StandardCharsets.ISO_8859_1));
      mv.visitLdcInsn("ISO-8859-1");
      mv.visitMethodInsn(INVOKEVIRTUAL, Type.getInternalName(String.class),
View Full Code Here

        if (funInfo.is_called_locally_in_tail_position)
          generate_tail_call_self(fun_type);

        if (funInfo.mustHaveFun() || uses_on_load) {
          FieldVisitor fv = cv.visitField(ACC_STATIC | (uses_on_load ? 0 : ACC_FINAL),
              mname, "L" + fun_type + ";", null, null);
          EFunCG.ensure(arity);

          if (is_exported) {
            if (ModuleAnalyzer.log.isLoggable(Level.FINE))
              ModuleAnalyzer.log.fine("export " + module_name
                  + ":" + fun_name + "/" + arity);
            AnnotationVisitor an = fv.visitAnnotation(
                EXPORT_ANN_TYPE.getDescriptor(), true);
            an.visit("module", module_name.getName());
            an.visit("fun", fun_name.getName());
            an.visit("arity", new Integer(arity));
            an.visitEnd();
          } else if (uses_on_load) {
            AnnotationVisitor an = fv.visitAnnotation(
                INTERNAL_ANN_TYPE.getDescriptor(), true);
            an.visit("module", module_name.getName());
            an.visit("fun", fun_name.getName());
            an.visit("arity", new Integer(arity));
            an.visitEnd();
          }

          fv.visitEnd();

          funs.put(mname, full_inner_name);
          funt.put(mname, fun_type);
          EFunCG.ensure(arity);
          make_fun = true;
View Full Code Here

            return null;
        }
    }
    private static Class<?> createNamespaceWrapperInternal(ASMHelper helper, ClassWriter cw) {
        String className = "org.apache.cxf.jaxb.NamespaceMapperInternal";
        FieldVisitor fv;
        MethodVisitor mv;
        cw.visit(Opcodes.V1_5,
                 Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
                 "org/apache/cxf/jaxb/NamespaceMapperInternal", null,
                 "com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper", null);

        cw.visitSource("NamespaceMapper.java", null);

        fv = cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL,
                           "nspref", "Ljava/util/Map;",
                           "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;", null);
        fv.visitEnd();
       
        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>",
                            "(Ljava/util/Map;)V",
                            "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;)V", null);
        mv.visitCode();
View Full Code Here

                fieldDescriptor = getClassCode(genericType);
            }
        }
        String fieldName = JavaUtils.isJavaKeyword(name) ? JavaUtils.makeNonJavaKeyword(name) : name;
       
        FieldVisitor fv = cw.visitField(Opcodes.ACC_PRIVATE,
                                        fieldName,
                                        classCode,
                                        fieldDescriptor,
                                        null);
       
       
        AnnotationVisitor av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlElement;", true);
        av0.visit("name", name);
        if (factory.isWrapperPartQualified(mpi)) {
            av0.visit("namespace", mpi.getConcreteName().getNamespaceURI());           
        }
        if (factory.isWrapperPartNillable(mpi)) {
            av0.visit("nillable", Boolean.TRUE);
        }
        if (factory.getWrapperPartMinOccurs(mpi) == 1) {
            av0.visit("required", Boolean.TRUE);
        }
        av0.visitEnd();

        List<Annotation> jaxbAnnos = getJaxbAnnos(mpi);
        addJAXBAnnotations(fv, jaxbAnnos);
        fv.visitEnd();

        String methodName = JAXBUtils.nameToIdentifier(name, JAXBUtils.IdentifierType.GETTER);
        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, methodName, "()" + classCode,
                                          fieldDescriptor == null ? null : "()" + fieldDescriptor,
                                          null);
View Full Code Here

        mv.visitEnd();
    }

    // public static <Interface> delegate;
    private static void declareField(ClassWriter cw, String interfaceName) {
        FieldVisitor fv =
            cw.visitField(ACC_PUBLIC + ACC_STATIC, DELEGATE_FIELD, getSignature(interfaceName), null, null);
        fv.visitEnd();
    }
View Full Code Here

TOP

Related Classes of org.objectweb.asm.FieldVisitor

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.