return new Component[]{};
}
private Component toComponentConfig(ComponentConfig annotation, Class<?> clazz) throws Exception
{
Component config = new Component();
if (annotation.id().length() > 0)
config.setId(annotation.id());
Class<?> type = annotation.type() == void.class ? clazz : annotation.type();
config.setType(type.getName());
if (annotation.template().length() > 0)
config.setTemplate(annotation.template());
if (annotation.lifecycle() != void.class)
config.setLifecycle(annotation.lifecycle().getName());
if (annotation.decorator().length() > 0)
config.setDecorator(annotation.decorator());
config.setInitParams(toInitParams(annotation.initParams()));
EventConfig[] eventAnnotations = annotation.events();
ArrayList<Event> events = new ArrayList<Event>();
for (EventConfig eventAnnotation : eventAnnotations)
{
events.add(toEventConfig(eventAnnotation));
}
config.setEvents(events);
EventInterceptorConfig[] eventInterceptorAnnotations = annotation.eventInterceptors();
ArrayList<EventInterceptor> eventInterceptors = new ArrayList<EventInterceptor>();
for (EventInterceptorConfig eventAnnotation : eventInterceptorAnnotations)
{
eventInterceptors.add(toEventInterceptorConfig(eventAnnotation));
}
config.setEventInterceptors(eventInterceptors);
ValidatorConfig[] validatorAnnotations = annotation.validators();
ArrayList<Validator> validators = new ArrayList<Validator>();
for (ValidatorConfig ele : validatorAnnotations)
{
validators.add(toValidator(ele));
}
config.setValidators(validators);
return config;
}