Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.AnnotationTypeDeclaration


    if ( outJAXB == null && outJSON == null && outXML == null ) {
      return;
    }

    final AnnotationTypeDeclaration annotationType = (AnnotationTypeDeclaration) processingEnv.getTypeDeclaration( "com.google.code.facebookapi.FacebookReturnType" );
    Collection<Declaration> elements = processingEnv.getDeclarationsAnnotatedWith( annotationType );

    AnnotationVisitor visitor = new AnnotationVisitor( outJAXB, outJSON, outXML );
    for ( Declaration element : elements ) {
      element.accept( visitor );
View Full Code Here


        // is a PropertySet, ensure the values assigned to the properties
        // satisfy all PropertySet and PropertyType constraints.
        for (AnnotationMirror m : mirrors)
        {
            AnnotationType type = m.getAnnotationType();
            AnnotationTypeDeclaration decl = m.getAnnotationType().getDeclaration();
            if (decl.getAnnotation(PropertySet.class) != null)
            {
                Iterator<Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue>> i = m
                        .getElementValues().entrySet().iterator();
                while (i.hasNext())
                {
                    Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry = i
                            .next();
                    Collection<Annotation> annotations = getMemberTypeAnnotations(entry.getKey());
                    if (annotations.size() > 0)
                    {
                        Annotation[] anArray = new Annotation[annotations.size()];
                        annotations.toArray(anArray);
                        validate(anArray, entry.getValue().getValue());
                    }
                }

                //If a membership rule is defined on the property set, ensure the rule is satisfied.
                if (decl.getAnnotation(MembershipRule.class) != null)
                {
                    try
                    {
                        String declClassName = decl.getQualifiedName();

                        TypeDeclaration owningClass = decl.getDeclaringType();
                        if (owningClass != null)
                            declClassName = owningClass.getQualifiedName() + "$" + decl.getSimpleName();
                           
                      Class clazz = Class.forName(declClassName);
                      Annotation a = d.getAnnotation(clazz);
                      validateMembership(a);
                    }
View Full Code Here

        // Iterate over annotations on operation, looking for interceptor-based ones
        Collection<AnnotationMirror> annotations = _methodDecl.getAnnotationMirrors();
        for ( AnnotationMirror a : annotations )
        {
            AnnotationType at = a.getAnnotationType();
            AnnotationTypeDeclaration atd = at.getDeclaration();
            Collection<AnnotationMirror> metaAnnotations = atd.getAnnotationMirrors();

            // Look for annotations that are meta-annotated with @InterceptorAnnotation
            for ( AnnotationMirror ma : metaAnnotations )
            {
                if ( ma.getAnnotationType().getDeclaration().getQualifiedName().
View Full Code Here

        // for each annotations defined on the declaration, if the annotation
        // is a PropertySet, ensure the values assigned to the properties
        // satisfy all PropertySet and PropertyType constraints.
        for (AnnotationMirror m : mirrors)
        {
            AnnotationTypeDeclaration decl = m.getAnnotationType().getDeclaration();
            /*
            when embedding this annotation processor in an IDE, the declaration
            could be null when it doesn't resolve to a valid type.  In this case,
            just continue processing declarations.
            */
            if(decl == null) {
                continue;
            }
            else if (decl.getAnnotation(PropertySet.class) != null)
            {
                Iterator<Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue>> i =
                    m.getElementValues().entrySet().iterator();
                while (i.hasNext())
                {
                    Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry =
                        i.next();
                    Collection<Annotation> annotations = getMemberTypeAnnotations(entry.getKey());
                    if (annotations.size() > 0)
                    {
                        Annotation[] anArray = new Annotation[annotations.size()];
                        annotations.toArray(anArray);
                        validate(anArray, entry.getValue().getValue());
                    }
                }

                //If a membership rule is defined on the property set, ensure the rule is satisfied.
                if (decl.getAnnotation(MembershipRule.class) != null)
                {
                    try
                    {
                        String declClassName = decl.getQualifiedName();

                        TypeDeclaration owningClass = decl.getDeclaringType();
                        if (owningClass != null)
                            declClassName = owningClass.getQualifiedName() + "$" + decl.getSimpleName();
                           
                      Class clazz = Class.forName(declClassName);
                      Annotation a = d.getAnnotation(clazz);
                      validateMembership(a);
                    }
View Full Code Here

        // Iterate over annotations on operation, looking for interceptor-based ones
        Collection<AnnotationMirror> annotations = _methodDecl.getAnnotationMirrors();
        for ( AnnotationMirror a : annotations )
        {
            AnnotationType at = a.getAnnotationType();
            AnnotationTypeDeclaration atd = at.getDeclaration();

            /*
            When performing annotation processing, the ATD here might be null if the apt.exe runtime
            is unable to resolve the type to something specific.  This will happen when a type referenced
            in a source file is invalid because of a bad / missing import, mis-spelling, etc.  When
            this happens, annotation processing should merilly continue and let javac.exe report
            the type errors.  Better to do that than to throw an NPE here.
            */
            if (atd == null)
                continue;

            Collection<AnnotationMirror> metaAnnotations = atd.getAnnotationMirrors();

            /*
            Look for annotations that are meta-annotated with @InterceptorAnnotation
            */
            for ( AnnotationMirror ma : metaAnnotations )
View Full Code Here

     * annotations discovered. Builds up a set of information about the ActionBeans discovered
     * and then prints it out according to the options passed in.
     */
    public void process() {
        // Process the URL Bindings First
        AnnotationTypeDeclaration typeDec = getTypeDeclaration(UrlBinding.class);
        Collection<Declaration> declarations = this.environment.getDeclarationsAnnotatedWith(typeDec);
        processUrlBindings(declarations);

        // Then the method level annotations
        typeDec = getTypeDeclaration(DefaultHandler.class);
View Full Code Here

        // for each annotations defined on the declaration, if the annotation
        // is a PropertySet, ensure the values assigned to the properties
        // satisfy all PropertySet and PropertyType constraints.
        for (AnnotationMirror m : mirrors)
        {
            AnnotationTypeDeclaration decl = m.getAnnotationType().getDeclaration();
            /*
            when embedding this annotation processor in an IDE, the declaration
            could be null when it doesn't resolve to a valid type.  In this case,
            just continue processing declarations.
            */
            if(decl == null) {
                continue;
            }
            else if (decl.getAnnotation(PropertySet.class) != null)
            {
                Iterator<Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue>> i =
                    m.getElementValues().entrySet().iterator();
                while (i.hasNext())
                {
                    Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry =
                        i.next();
                    Collection<Annotation> annotations = getMemberTypeAnnotations(entry.getKey());
                    if (annotations.size() > 0)
                    {
                        Annotation[] anArray = new Annotation[annotations.size()];
                        annotations.toArray(anArray);
                        validate(anArray, entry.getValue().getValue());
                    }
                }

                //If a membership rule is defined on the property set, ensure the rule is satisfied.
                if (decl.getAnnotation(MembershipRule.class) != null)
                {
                    try
                    {
                        String declClassName = decl.getQualifiedName();

                        TypeDeclaration owningClass = decl.getDeclaringType();
                        if (owningClass != null)
                            declClassName = owningClass.getQualifiedName() + "$" + decl.getSimpleName();
                           
                      Class clazz = Class.forName(declClassName);
                      Annotation a = d.getAnnotation(clazz);
                      validateMembership(a);
                    }
View Full Code Here

        // Iterate over annotations on operation, looking for interceptor-based ones
        Collection<AnnotationMirror> annotations = _methodDecl.getAnnotationMirrors();
        for ( AnnotationMirror a : annotations )
        {
            AnnotationType at = a.getAnnotationType();
            AnnotationTypeDeclaration atd = at.getDeclaration();

            /*
            When performing annotation processing, the ATD here might be null if the apt.exe runtime
            is unable to resolve the type to something specific.  This will happen when a type referenced
            in a source file is invalid because of a bad / missing import, mis-spelling, etc.  When
            this happens, annotation processing should merilly continue and let javac.exe report
            the type errors.  Better to do that than to throw an NPE here.
            */
            if (atd == null)
                continue;

            Collection<AnnotationMirror> metaAnnotations = atd.getAnnotationMirrors();

            /*
            Look for annotations that are meta-annotated with @InterceptorAnnotation
            */
            for ( AnnotationMirror ma : metaAnnotations )
View Full Code Here

                            // empty string, pass in an empty set of
                            // annotation type declarations.
                            if (!matchedStrings.equals(emptyStringSet)) {
                                for(String s: matchedStrings) {
                                    TypeDeclaration decl = aptenv.declMaker.getTypeDeclaration(s);
                                    AnnotationTypeDeclaration annotdecl;
                                    if (decl == null) {
                                        bark.aptError("DeclarationCreation", s);
                                    } else {
                                        try {
                                            annotdecl = (AnnotationTypeDeclaration)decl;
View Full Code Here

      Collection<AnnotationMirror> annotationMirrors = declaration.getAnnotationMirrors();
      for (AnnotationMirror annotationMirror : annotationMirrors) {
        AnnotationType annotationType = annotationMirror.getAnnotationType();
        if (annotationType != null) {
          AnnotationTypeDeclaration annotationDeclaration = annotationType.getDeclaration();
          facet = annotationDeclaration.getAnnotation(org.codehaus.enunciate.Facet.class);
          if (facet != null) {
            bucket.add(new Facet(facet, annotationDeclaration.getSimpleName()));
          }
          facets = annotationDeclaration.getAnnotation(Facets.class);
          if (facets != null) {
            for (org.codehaus.enunciate.Facet f : facets.value()) {
              bucket.add(new Facet(f, annotationDeclaration.getSimpleName()));
            }
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.sun.mirror.declaration.AnnotationTypeDeclaration

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.