public class ComponentMetadataTransformerListener implements SystemEventListener {
public void processEvent(SystemEvent event) throws AbortProcessingException {
try {
if (event instanceof PostAddToViewEvent) {
PostAddToViewEvent postAddToViewEvent = (PostAddToViewEvent) event;
FacesContext context = FacesContext.getCurrentInstance();
RequestContext requestContext = RequestContext.getCurrentInstance();
ConfigContainer config = requestContext.getApplicationContext().getConfig();
if (config.isTransformMetadataEnabled() && config.isBeanValidationAvailable()) {
BeanValidationComponentMetadataTransformer.getInstance().transform(context, requestContext, postAddToViewEvent.getComponent());
}
}
}
catch (IOException e) {
throw new FacesException(e);