use of org.osgl.mvc.util.Binder in project actframework by actframework.
the class ParamValueLoaderService method binder.
protected final ParamValueLoader binder(BeanSpec spec, String bindName) {
Class rawType = spec.rawType();
ParamValueLoader loader = null;
{
Bind bind = spec.getAnnotation(Bind.class);
if (null != bind) {
for (Class<? extends Binder> binderClass : bind.value()) {
Binder binder = injector.get(binderClass);
if (rawType.isAssignableFrom(binder.targetType())) {
loader = new BoundedValueLoader(binder, bindName);
break;
}
}
}
}
if (null == loader) {
Annotation[] aa = spec.taggedAnnotations(Bind.class);
if (aa.length > 0) {
for (Annotation a : aa) {
Bind bind = AnnotationUtil.tagAnnotation(a, Bind.class);
for (Class<? extends Binder> binderClass : bind.value()) {
Binder binder = injector.get(binderClass);
binder.attributes($.evaluate(a));
if (rawType.isAssignableFrom(binder.targetType())) {
loader = new BoundedValueLoader(binder, bindName);
break;
}
}
}
}
}
if (null == loader) {
Binder binder = binderManager.binder(rawType);
if (null != binder) {
loader = new BoundedValueLoader(binder, bindName);
}
}
return loader;
}
Aggregations