Package org.objectweb.asm.attrs

Examples of org.objectweb.asm.attrs.Annotation


        public void visitAttribute(Attribute attr) {
            if (attr instanceof RuntimeVisibleAnnotations) {
                RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) attr;
                for (Object annotation : rva.annotations) {
                    if (annotation instanceof Annotation) {
                        Annotation ann = (Annotation) annotation;
                        for (String annTypeDesc : annotationTypeDescs) {
                            if (ann.type.equals(annTypeDesc)) {
                                // we have found one of the annotations -> we won't need to add it again !
                                annotationTypeDescs.remove(annTypeDesc);
                                break;
View Full Code Here


                classIsModified = true;
                RuntimeVisibleAnnotations attr = new RuntimeVisibleAnnotations();

                for (String annTypeDesc : annotationTypeDescs) {

                    Annotation ann = new Annotation(annTypeDesc);
                    ann.add("name", "");

                    attr.annotations.add(ann);
                }

                cv.visitAttribute(attr);
View Full Code Here

     */

    public static Annotation createCustomAnnotation(final byte[] bytes) {

        Annotation annotation = new Annotation();

        annotation.type = CustomAttribute.TYPE;

        annotation.add(VALUE, Base64.encodeBytes(bytes));

        return annotation;

    }
View Full Code Here

            if (current instanceof RuntimeInvisibleAnnotations) {

                for (Iterator it = ((RuntimeInvisibleAnnotations) current).annotations.iterator(); it.hasNext();) {

                    Annotation annotation = (Annotation) it.next();

                    if (CustomAttribute.TYPE.equals(annotation.type)) {

                        annotations.add(CustomAttributeHelper.extractCustomAnnotation(annotation));

                    } else {

                        AnnotationInfo annotationInfo = AsmClassInfo.getAnnotationInfo(

                                annotation,

                                loader

                        );

                        annotations.add(annotationInfo);

                    }

                }

            } else if (current instanceof RuntimeVisibleAnnotations) {

                for (Iterator it = ((RuntimeVisibleAnnotations) current).annotations.iterator(); it.hasNext();) {

                    Annotation annotation = (Annotation) it.next();

                    AnnotationInfo annotationInfo = AsmClassInfo.getAnnotationInfo(

                            annotation,
View Full Code Here

     *
     * @param bytes
     * @return
     */
    public static Annotation createCustomAnnotation(final byte[] bytes) {
        Annotation annotation = new Annotation();
        annotation.type = CustomAttribute.TYPE;
        annotation.add(VALUE, Base64.encodeBytes(bytes));
        return annotation;
    }
View Full Code Here

     * Create an Annotation bytecode representation from the serialized version of the custom annotation proxy
     * @param bytes
     * @return
     */
    public static Annotation createCustomAnnotation(final byte[] bytes) {
        Annotation annotation = new Annotation();
        annotation.type = CustomAttribute.TYPE;
        annotation.add(VALUE, Base64.encodeBytes(bytes));
        return annotation;
    }
View Full Code Here

     *
     * @param bytes
     * @return
     */
    public static Annotation createCustomAnnotation(final byte[] bytes) {
        Annotation annotation = new Annotation();
        annotation.type = CustomAttribute.TYPE;
        annotation.add(VALUE, Base64.encodeBytes(bytes));
        return annotation;
    }
View Full Code Here

     */
    public static List extractAnnotations(List annotations, final Attribute attribute, final ClassLoader loader) {
        for (Attribute current = attribute; current != null; current = current.next) {
            if (current instanceof RuntimeInvisibleAnnotations) {
                for (Iterator it = ((RuntimeInvisibleAnnotations) current).annotations.iterator(); it.hasNext();) {
                    Annotation annotation = (Annotation) it.next();
                    if (CustomAttribute.TYPE.equals(annotation.type)) {
                        annotations.add(CustomAttributeHelper.extractCustomAnnotation(annotation));
                    } else {
                        AnnotationInfo annotationInfo = getAnnotationInfo(annotation, loader);
                        annotations.add(annotationInfo);
                    }
                }
            } else if (current instanceof RuntimeVisibleAnnotations) {
                for (Iterator it = ((RuntimeVisibleAnnotations) current).annotations.iterator(); it.hasNext();) {
                    Annotation annotation = (Annotation) it.next();
                    AnnotationInfo annotationInfo = getAnnotationInfo(annotation, loader);
                    annotations.add(annotationInfo);
                }
            } else if (current instanceof AnnotationDefaultAttribute) {
                AnnotationDefaultAttribute defaultAttribute = (AnnotationDefaultAttribute) current;
View Full Code Here

     * Create an Annotation bytecode representation from the serialized version of the custom annotation proxy
     * @param bytes
     * @return
     */
    public static Annotation createCustomAnnotation(final byte[] bytes) {
        Annotation annotation = new Annotation();
        annotation.type = CustomAttribute.TYPE;
        annotation.add(VALUE, Base64.encodeBytes(bytes));
        return annotation;
    }
View Full Code Here

     */
    public static List extractAnnotations(List annotations, final Attribute attribute, final ClassLoader loader) {
        for (Attribute current = attribute; current != null; current = current.next) {
            if (current instanceof RuntimeInvisibleAnnotations) {
                for (Iterator it = ((RuntimeInvisibleAnnotations) current).annotations.iterator(); it.hasNext();) {
                    Annotation annotation = (Annotation) it.next();
                    if (CustomAttribute.TYPE.equals(annotation.type)) {
                        annotations.add(CustomAttributeHelper.extractCustomAnnotation(annotation));
                    } else {
                        AnnotationInfo annotationInfo = AsmClassInfo.getAnnotationInfo(
                                annotation,
                                loader
                        );
                        annotations.add(annotationInfo);
                    }
                }
            } else if (current instanceof RuntimeVisibleAnnotations) {
                for (Iterator it = ((RuntimeVisibleAnnotations) current).annotations.iterator(); it.hasNext();) {
                    Annotation annotation = (Annotation) it.next();
                    AnnotationInfo annotationInfo = AsmClassInfo.getAnnotationInfo(
                            annotation,
                            loader
                    );
                    annotations.add(annotationInfo);
View Full Code Here

TOP

Related Classes of org.objectweb.asm.attrs.Annotation

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.