Package org.objectweb.asm

Examples of org.objectweb.asm.MethodVisitor.visitAnnotation()


    int access = getAccess(method);
    String desc = md.toDescriptorString();
   
    MethodVisitor mv = context.getClassWriter().visitMethod(access, method.getName(), desc, null, exceptions);
    for (IBytecodeAnnotation ba : method.getDeclaredAnnotations()) {
      this.declareAnnotation(context, ba, mv.visitAnnotation(ba.getType().getType().toDescriptorString(), true));
    }

    if (method instanceof BytecodeMethodConcrete) {
      BytecodeContextMethodASM ctx = new BytecodeContextMethodASM(mv, method, context, writer);
      ((BytecodeMethodConcrete) method).write(ctx);
View Full Code Here


        Map<String, Map<String, Object>> annotations = (Map<String, Map<String, Object>>) props.get("annotations");
        if (annotations != null) {
            for (Map.Entry<String, Map<String, Object>> entry : annotations.entrySet()) {
                String annotationClass = entry.getKey();
                Map<String, Object> annotationValues = entry.getValue();
                AnnotationVisitor av = getter.visitAnnotation("L" + getInternalName(annotationClass) + ";", true);
                for (Map.Entry<String, Object> values : annotationValues.entrySet()) {
                    final String paramName = values.getKey();
                    Object paramValue = values.getValue();
                    if (Class.class.isAssignableFrom(paramValue.getClass())) {
                        paramValue = org.objectweb.asm.Type.getType("L" + getInternalName(paramValue.getClass().getName()) + ";");
View Full Code Here

        Map<String, Map<String, Object>> annotations = (Map<String, Map<String, Object>>) props.get("annotations");
        if (annotations != null) {
            for (Map.Entry<String, Map<String, Object>> entry : annotations.entrySet()) {
                String annotationClass = entry.getKey();
                Map<String, Object> annotationValues = entry.getValue();
                AnnotationVisitor av = getter.visitAnnotation("L" + getInternalName(annotationClass) + ";", true);
                for (Map.Entry<String, Object> values : annotationValues.entrySet()) {
                    final String paramName = values.getKey();
                    Object paramValue = values.getValue();
                    if (Class.class.isAssignableFrom(paramValue.getClass())) {
                        paramValue = org.objectweb.asm.Type.getType("L" + getInternalName(paramValue.getClass().getName()) + ";");
View Full Code Here

        av0.visitEnd();
        fv.visitEnd();

        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(IIIIIIIIII)V", null, null);
        // visible method annotation
        mv.visitAnnotation(DEPRECATED, true).visitEnd();
        // invisible method annotation
        av0 = mv.visitAnnotation("Lpkg/Annotation;", false);
        av0.visitAnnotation("annotationValue", DOC).visitEnd();
        av0.visitEnd();
        // synthetic parameter annotation
View Full Code Here

        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(IIIIIIIIII)V", null, null);
        // visible method annotation
        mv.visitAnnotation(DEPRECATED, true).visitEnd();
        // invisible method annotation
        av0 = mv.visitAnnotation("Lpkg/Annotation;", false);
        av0.visitAnnotation("annotationValue", DOC).visitEnd();
        av0.visitEnd();
        // synthetic parameter annotation
        mv.visitParameterAnnotation(0, "Ljava/lang/Synthetic;", false);
        // visible parameter annotation
View Full Code Here

        if (method.name.equals("main")) jcout.hasMain = true;

        if ((method.crCuid != null && !method.crCuid.equals("")) || method.crOuter >= -1) {
            Type crAnnType = Type.getType("Lorg/perl6/nqp/runtime/CodeRefAnnotation;");
            AnnotationVisitor av = m.visitAnnotation(crAnnType.getDescriptor(), true);
            av.visit("name", method.crName);
            if (method.crCuid != null && !method.crCuid.isEmpty()) av.visit("cuid", method.crCuid);
            if (method.crOuter >= 0) av.visit("outerQbid", method.crOuter);

            AnnotationVisitor avLex;
View Full Code Here

        Map<String, Map<String, Object>> annotations = (Map<String, Map<String, Object>>) props.get("annotations");
        if (annotations != null) {
            for (Map.Entry<String, Map<String, Object>> entry : annotations.entrySet()) {
                String annotationClass = entry.getKey();
                Map<String, Object> annotationValues = entry.getValue();
                AnnotationVisitor av = getter.visitAnnotation("L" + getInternalName(annotationClass) + ";", true);
                for (Map.Entry<String, Object> values : annotationValues.entrySet()) {
                    final String paramName = values.getKey();
                    Object paramValue = values.getValue();
                    if (Class.class.isAssignableFrom(paramValue.getClass())) {
                        paramValue = org.objectweb.asm.Type.getType("L" + getInternalName(paramValue.getClass().getName()) + ";");
View Full Code Here

        //gen in custom package!
        String completeName = "org/glassfish/admin/rest/resources/custom/" + resourceClassName;
        String baseClassName = GENERATED_PATH + className;
        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "get" + resourceClassName, "()L" + completeName + ";", null, null);

        AnnotationVisitor av0 = mv.visitAnnotation("Ljavax/ws/rs/Path;", true);
        av0.visit("value", mappingPath + "/");
        av0.visitEnd();

        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
View Full Code Here

    @Override
    public void createGetCommandResource(String commandResourceClassName, String resourcePath) {
        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "get" + commandResourceClassName, "()L" + GENERATED_PATH + commandResourceClassName + ";", null, null);

        AnnotationVisitor av0 = mv.visitAnnotation("Ljavax/ws/rs/Path;", true);
        av0.visit("value", resourcePath + "/");
        av0.visitEnd();

        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
View Full Code Here

            return;
        }

        generatedMethods.put(methodName, childClass);
        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "()L"+ childClass + ";", null, null);
        AnnotationVisitor av0 = mv.visitAnnotation("Ljavax/ws/rs/Path;", true);
        av0.visit("value", path + "/");
        av0.visitEnd();

        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.