use of act.controller.ActionMethodParamAnnotationHandler in project actframework by actframework.
the class ParamValueLoaderService method paramAnnoHandlers.
private Map<Class<? extends Annotation>, ActionMethodParamAnnotationHandler> paramAnnoHandlers(BeanSpec spec) {
Map<Class<? extends Annotation>, ActionMethodParamAnnotationHandler> handlers = annoHandlers.get(spec);
if (null != handlers) {
return handlers;
}
Map<Class<? extends Annotation>, ActionMethodParamAnnotationHandler> newHandlers = new HashMap<>();
for (Annotation annotation : spec.allAnnotations()) {
Class<? extends Annotation> c = annotation.annotationType();
ActionMethodParamAnnotationHandler h = allAnnotationHandlers.get(c);
if (null != h) {
newHandlers.put(c, h);
}
}
handlers = annoHandlers.putIfAbsent(spec, newHandlers);
if (null == handlers) {
handlers = newHandlers;
}
return handlers;
}
use of act.controller.ActionMethodParamAnnotationHandler in project actframework by actframework.
the class GenieInjector method genie.
public Genie genie() {
if (null == genie) {
synchronized (this) {
if (null == genie) {
InjectListener listener = new GenieListener(this);
genie = Genie.create(listener, modules.toArray(new Object[modules.size()]));
for (Map.Entry<Class, DependencyInjectionBinder> entry : binders.entrySet()) {
genie.registerProvider(entry.getKey(), entry.getValue());
}
$.F2<Class, NamedProvider, Void> namedProviderRegister = new $.F2<Class, NamedProvider, Void>() {
@Override
public Void apply(Class aClass, NamedProvider namedProvider) throws NotAppliedException, Osgl.Break {
genie.registerNamedProvider(aClass, namedProvider);
return null;
}
};
$.F2<Class, Provider, Void> register = new $.F2<Class, Provider, Void>() {
@Override
public Void apply(Class aClass, Provider provider) throws NotAppliedException, Osgl.Break {
genie.registerProvider(aClass, provider);
return null;
}
};
genie.registerQualifiers(Bind.class, Param.class);
genie.registerScopeAlias(Singleton.class, Stateless.class);
genie.registerScopeAlias(Singleton.class, InheritedStateless.class);
genie.registerScopeAlias(StopInheritedScope.class, Stateful.class);
List<ActionMethodParamAnnotationHandler> list = Act.pluginManager().pluginList(ActionMethodParamAnnotationHandler.class);
for (ActionMethodParamAnnotationHandler h : list) {
Set<Class<? extends Annotation>> set = h.listenTo();
for (Class<? extends Annotation> c : set) {
genie.registerQualifiers(c);
}
}
ActProviders.registerBuiltInProviders(ActProviders.class, register);
ActProviders.registerBuiltInProviders(GenieProviders.class, register);
ActProviders.registerBuiltInNamedProviders(ActProviders.class, namedProviderRegister);
ActProviders.registerBuiltInNamedProviders(GenieProviders.class, namedProviderRegister);
for (Class<? extends Annotation> injectTag : injectTags) {
genie.registerInjectTag(injectTag);
}
genie.registerProvider(Genie.class, new Provider<Genie>() {
@Override
public Genie get() {
return genie;
}
});
}
}
}
return genie;
}
Aggregations