Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2008, Red Hat, Inc., and individual contributors
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.jboss.weld.annotated.enhanced.jlr;
 
 import java.util.Map;
 import java.util.Set;
 
 
 
Represents an annotated annotation

This class is immutable and therefore threadsafe

Parameters:
<T>
Author(s):
Pete Muir
 
 public class EnhancedAnnotationImpl<T extends Annotationextends EnhancedAnnotatedTypeImpl<T> implements EnhancedAnnotation<T> {
 
     // The annotated members map (annotation -> member with annotation)
     private final SetMultimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ?>> annotatedMembers;
     // The implementation class of the annotation
     private final Class<T> clazz;
     // The set of abstracted members
     private final Set<EnhancedAnnotatedMethod<?, ?>> members;
 
     //we can't call this method 'of', cause it won't compile on JDK7
     public static <A extends AnnotationEnhancedAnnotation<A> create(SlimAnnotatedType<A> annotatedTypeClassTransformer classTransformer) {
 
         Class<A> annotationType = annotatedType.getJavaClass();
 
         Map<Class<? extends Annotation>, AnnotationannotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
         annotationMap.putAll(buildAnnotationMap(annotatedType.getAnnotations()));
         annotationMap.putAll(buildAnnotationMap(classTransformer.getTypeStore().get(annotationType)));
         // Annotations and declared annotations are the same for annotation type
         return new EnhancedAnnotationImpl<A>(annotatedTypeannotationMapannotationMapclassTransformer);
     }

    
Constructor

Initializes the superclass with the built annotation map

Parameters:
annotationType The annotation type
 
     protected EnhancedAnnotationImpl(SlimAnnotatedType<T> annotatedTypeMap<Class<? extends Annotation>, AnnotationannotationMapMap<Class<? extends Annotation>, AnnotationdeclaredAnnotationMapClassTransformer classTransformer) {
         super(annotatedTypeannotationMapdeclaredAnnotationMapclassTransformer);
         this. = annotatedType.getJavaClass();
          = new HashSet<EnhancedAnnotatedMethod<?, ?>>();
          = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<EnhancedAnnotatedMethod<?, ?>>>(), HashSetSupplier.<EnhancedAnnotatedMethod<?, ?>>instance());
         for (AnnotatedMethod<? super T> annotatedMethod : annotatedType.getMethods()) {
             EnhancedAnnotatedMethod<?, ? super T> enhancedAnnotatedMethod = EnhancedAnnotatedMethodImpl.of(annotatedMethodthisclassTransformer);
             .add(enhancedAnnotatedMethod);
             for (Annotation annotation : enhancedAnnotatedMethod.getAnnotations()) {
                 .put(annotation.annotationType(), enhancedAnnotatedMethod);
             }
         }
     }
 
     @Override
     protected Set<EnhancedAnnotatedMethod<?, ? super T>> getOverriddenMethods(EnhancedAnnotatedType<T> annotatedTypeSet<EnhancedAnnotatedMethod<?, ? super T>> methodsboolean skipOverridingBridgeMethods) {
         return Collections.emptySet();
     }

    
Gets all members of the annotation

Initializes the members first if they are null

Returns:
The set of abstracted members
See also:
org.jboss.weld.annotated.enhanced.EnhancedAnnotation.getMembers()
    public Set<EnhancedAnnotatedMethod<?, ?>> getMembers() {
        return Collections.unmodifiableSet();
    }

    
Returns the annotated members with a given annotation type

If the annotated members are null, they are initialized first.

Parameters:
annotationType The annotation type to match
Returns:
The set of abstracted members with the given annotation type present. An empty set is returned if no matches are found
See also:
org.jboss.weld.annotated.enhanced.EnhancedAnnotation.getMembers(java.lang.Class)
    public Set<EnhancedAnnotatedMethod<?, ?>> getMembers(Class<? extends AnnotationannotationType) {
        return Collections.unmodifiableSet(.get(annotationType));
    }

    
Gets a string representation of the annotation

Returns:
A string representation
    @Override
    public String toString() {
        return getJavaClass().toString();
    }
    @Override
    public Class<T> getDelegate() {
        return ;
    }
    @Override
    public int hashCode() {
        return super.hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        EnhancedAnnotationImpl<?> that = cast(obj);
        return super.equals(that);
    }
New to GrepCode? Check out our FAQ X