List<Object> components = tblueprint.getServiceOrReferenceListOrBean();
// try to process classes that have @ReferenceListener or @RegistrationLister first
// as we want the refl and regl maps populated before processing @Bean annotation.
for (Class refListener : refListenerClasses) {
Bean bean = (Bean) refListener.getAnnotation(Bean.class);
// register the treference with its id
TreferenceListener tref = generateTrefListener(refListener);
if (bean.id().length() > 0) {
reflMap.put(bean.id(), tref);
} else {
throw new BlueprintAnnotationException("Unable to find the id for the @ReferenceListener annotated class " + refListener.getName());
}
}
for (Class regListener : regListenerClasses) {
Bean bean = (Bean) regListener.getAnnotation(Bean.class);
// register the tregistrationListener with its id
TregistrationListener tref = generateTregListener(regListener);
if (bean.id().length() > 0) {
reglMap.put(bean.id(), tref);
} else {
throw new BlueprintAnnotationException("Unable to find the id for the @RegistrationListener annotated class " + regListener.getName());
}
}
for (Class clazz : beanClasses) {
// @Bean annotation detected
Bean bean = (Bean)clazz.getAnnotation(Bean.class);
Tbean tbean = new Tbean();
// process depends-on property
String[] dependsOn = bean.dependsOn();
if (!containsValid(dependsOn)) {
tbean.setDependsOn(null);
} else {
List<String> dons = Arrays.asList(dependsOn);
tbean.setDependsOn(dons);
}
// process id property
String id = bean.id();
if (id.length() > 0) {
tbean.setId(id);
} else {
// should we auto generate an id, based on the class name?
tbean.setId(clazz.getSimpleName());
}
// process the clazz property
tbean.setClazz(clazz.getName());
// process activation
String activation = bean.activation();
if (activation.length() > 0) {
if (activation.equalsIgnoreCase("eager") || activation.equalsIgnoreCase("lazy")) {
tbean.setActivation(bean.activation());
} else {
throw new BlueprintAnnotationException("Invalid bean activation value " + activation + " for " + clazz.getName());
}
}
// process description
if (bean.description().length() > 0) {
Tdescription desp = new Tdescription();
desp.getContent().add(bean.description());
tbean.setDescription(desp);
}
// process scope
String scope = bean.scope();
if (scope.length() > 0) {
if (scope.equalsIgnoreCase("singleton") || scope.equalsIgnoreCase("prototype")) {
tbean.setScope(scope);
} else {
throw new BlueprintAnnotationException("Invalid bean scope value " + scope + " for " + clazz.getName());
}
}
// process factory ref
String factoryRef = bean.factoryRef();
if (factoryRef.length() > 0) {
tbean.setFactoryRef(factoryRef);
}
// process factory method
String factoryMethod = bean.factoryMethod();
if (factoryMethod.length() > 0) {
tbean.setFactoryMethod(factoryMethod);
}
List<Object> props = tbean.getArgumentOrPropertyOrAny();
// process args
Arg[] args = bean.args();
if (args.length > 0) {
for (int i = 0; i < args.length; i++) {
Targument targ = createTargument(args[i]);
if (targ != null) {