private void handleFacesBehavior(FacesConfigImpl facesConfig, Set<Class<?>> classes)
{
for (Class<?> clazz : classes)
{
FacesBehavior facesBehavior = (FacesBehavior) clazz.getAnnotation(FacesBehavior.class);
if (facesBehavior != null)
{
// Can only apply @FacesBehavior to Behavior implementors.
if (!javax.faces.component.behavior.Behavior.class.isAssignableFrom(clazz))
{
// Just log this. We'll catch it later in the runtime.
if (log.isLoggable(Level.WARNING))
{
log.warning(clazz.getName()
+ " is annotated with @javax.faces.component.behavior.FacesBehavior, "
+ "but does not implement javax.faces.component.behavior.Behavior");
}
}
if (log.isLoggable(Level.FINEST))
{
log.finest("addBehavior(" + facesBehavior.value() + ", " + clazz.getName() + ")");
}
BehaviorImpl behavior = new BehaviorImpl();
behavior.setBehaviorId(facesBehavior.value());
behavior.setBehaviorClass(clazz.getName());
facesConfig.addBehavior(behavior);
}
}