angularBeans.boot.BeanRegistry Maven / Gradle / Ivy
package angularBeans.boot;
import java.util.HashSet;
import java.util.Set;
import angularBeans.ngservices.NGService;
import angularBeans.util.NGBean;
/**
* used by:
* -AngularBeansServletContextListenerAnnotated
*
-ModuleGenerator
*
-AngularBeansCDIExtention
*
* The BeanRegistry is used to store CDI beans info detected at deployment
* time to boost javascript generation performances later on the ModuleGenerator
* (pre generated and compressed js)
*
*it will store specific CDI beans definitions:
*@AngularBeans (as wrapped NGBean)
*, angularBeans built-in angularJs services (NGService)
*, the @NGApp definition
*
*combined with specific beans dependent javascript part's (related to RPC methods call)
*will produce the final "angular-beans.js" script.
* @author bessem hmidi
*
*/
public class BeanRegistry {
private static BeanRegistry instance = new BeanRegistry();
private Set angularBeans = new HashSet<>();
private Set extentions = new HashSet<>();
private Class extends Object> appClass;
/**
* AngularBeansCDIExtention wi
* @param appClass
*/
public void registerApp(Class appClass) {
this.appClass = appClass;
}
public void registerBean(Class targetClass) {
angularBeans.add(new NGBean(targetClass));
}
public void registerExtention(NGService extention) {
extentions.add(extention);
}
public Set getAngularBeans() {
return angularBeans;
}
public static synchronized BeanRegistry getInstance() {
return instance;
}
public Set getExtentions() {
return extentions;
}
public Class extends Object> getAppClass() {
return appClass;
}
}