public boolean isAnnotationApplicableToPhase ( Annotation annotation , PhaseIdType currentPhase , PhaseIdType [ ] defaultPhases ) { Method restrictAtViewMethod = getRestrictAtViewMethod ( annotation ) ; PhaseIdType [ ] phasedIds = null ; if ( restrictAtViewMethod != null ) { log . warnf ( "Annotation %s is using the restrictAtViewMethod. Use a @RestrictAtPhase qualifier on the annotation instead." ) ; phasedIds = getRestrictedPhaseIds ( restrictAtViewMethod , annotation ) ; } RestrictAtPhase restrictAtPhaseQualifier = AnnotationInspector . getAnnotation ( annotation . annotationType ( ) , RestrictAtPhase . class , beanManager ) ; if ( restrictAtPhaseQualifier != null ) { log . debug ( "Using Phases found in @RestrictAtView qualifier on the annotation." ) ; phasedIds = restrictAtPhaseQualifier . value ( ) ; } if ( phasedIds == null ) { log . debug ( "Falling back on default phase ids" ) ; phasedIds = defaultPhases ; } if ( Arrays . binarySearch ( phasedIds , currentPhase ) >= 0 ) { return true ; } return false ; }
Inspect an annotation to see if it specifies a view in which it should be . Fall back on default view otherwise .