use of jakarta.faces.event.NamedEvent in project myfaces by apache.
the class AnnotationConfigurator method handleNamedEvent.
private void handleNamedEvent(FacesConfigImpl facesConfig, Set<Class<?>> classes) {
for (Class<?> clazz : classes) {
NamedEvent namedEvent = (NamedEvent) clazz.getAnnotation(NamedEvent.class);
if (namedEvent != null) {
// Can only apply @NamedEvent to ComponentSystemEvent subclasses.
if (!ComponentSystemEvent.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 @jakarta.faces.event.NamedEvent, but does " + "not extend jakarta.faces.event.ComponentSystemEvent");
}
}
// Have to register @NamedEvent annotations with the NamedEventManager class since
// we need to get access to this info later and can't from the dispenser (it's not a
// singleton).
org.apache.myfaces.config.impl.element.NamedEventImpl namedEventConfig = new org.apache.myfaces.config.impl.element.NamedEventImpl();
namedEventConfig.setEventClass(clazz.getName());
namedEventConfig.setShortName(namedEvent.shortName());
facesConfig.addNamedEvent(namedEventConfig);
}
}
}
Aggregations