use of org.osgl.mvc.annotation.Bind in project actframework by actframework.
the class ParamValueLoaderService method tryFindBindName.
static String tryFindBindName(Annotation[] annotations, String defVal) {
Param param = filter(annotations, Param.class);
if (null != param && S.notBlank(param.value())) {
return param.value();
}
Bind bind = filter(annotations, Bind.class);
if (null != bind && S.notBlank(bind.model())) {
return bind.model();
}
Named named = filter(annotations, Named.class);
if (null != named && S.notBlank(named.value())) {
return named.value();
}
if (S.notBlank(defVal)) {
return defVal;
}
return null;
}
use of org.osgl.mvc.annotation.Bind 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;
}