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.metadata.cache;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.ElementType.TYPE;
 
 import java.util.Set;
 
 
Model of a binding type

Author(s):
Pete Muir
 
 public class QualifierModel<T extends Annotationextends AbstractBindingModel<T> {
 
     private static final Set<Class<? extends Annotation>> META_ANNOTATIONS = Collections.<Class<? extends Annotation>>singleton(Qualifier.class);

    
Constructor

Parameters:
type The type
 
     public QualifierModel(EnhancedAnnotation<T> enhancedAnnotatedAnnotation) {
         super(enhancedAnnotatedAnnotation);
     }
 
     @Override
     protected void initValid(EnhancedAnnotation<T> annotatedAnnotation) {
         super.initValid(annotatedAnnotation);
         for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : annotatedAnnotation.getMembers()) {
             if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !getNonBindingMembers().contains(annotatedMethod.slim())) {
                 ..nonBindingMemberType(annotatedMethod);
                 super. = false;
             }
         }
     }

    
Validates the members
 
     protected void check(EnhancedAnnotation<T> annotatedAnnotation) {
         super.check(annotatedAnnotation);
         if (isValid()) {
 
             if (!annotatedAnnotation.isAnnotationPresent(Target.class)) {
                 ..missingTarget(annotatedAnnotation);
             } else if (!Arrays2.unorderedEquals(annotatedAnnotation.getAnnotation(Target.class).value(), )) {
                 ..missingTargetMethodFieldParameterType(annotatedAnnotation);
             }
         }
     }

    
Gets the meta-annotation type

Returns:
The BindingType class
 
     @Override
     protected Set<Class<? extends Annotation>> getMetaAnnotationTypes() {
         return ;
     }

    
Indicates if there are non-binding types present

Returns:
True if present, false otherwise
    public boolean hasNonBindingMembers() {
        return getNonBindingMembers().size() > 0;
    }

    
Comparator for checking equality

Parameters:
instance The instance to check against
other The other binding type
Returns:
True if equal, false otherwise
    public boolean isEqual(Annotation instanceAnnotation other) {
        if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType())) {
            for (AnnotatedMethod<?> annotatedMethod : getAnnotatedAnnotation().getMethods()) {
                if (!getNonBindingMembers().contains(annotatedMethod)) {
                    try {
                        AccessController.doPrivileged(SetAccessibleAction.of(annotatedMethod.getJavaMember()));
                        Object thisValue = annotatedMethod.getJavaMember().invoke(instance);
                        Object thatValue = annotatedMethod.getJavaMember().invoke(other);
                        if (!thisValue.equals(thatValue)) {
                            return false;
                        }
                    } catch (IllegalArgumentException e) {
                        throw new WeldException(e);
                    } catch (IllegalAccessException e) {
                        throw new WeldException(e);
                    } catch (InvocationTargetException e) {
                        throw new WeldException(e);
                    }
                }
            }
            return true;
        }
        return false;
    }

    
Gets a string representation of the qualifier model

Returns:
The string representation
    @Override
    public String toString() {
        return (isValid() ? "Valid" : "Invalid") + " qualifier model for " + getRawType() + " with non-binding members " + getNonBindingMembers();
    }
New to GrepCode? Check out our FAQ X