use of org.beetl.core.om.MethodInvoker in project beetl2.0 by javamonkey.
the class Type method getType.
public Type getType(String attrName) throws BeetlException {
if (Map.class.isAssignableFrom(cls)) {
if (types != null) {
return types[1];
} else {
}
return ObjectType;
} else if (Collection.class.isAssignableFrom(cls)) {
if (types != null) {
return types[0];
} else {
return ObjectType;
}
} else // }
if (cls == Object.class) {
return new Type(Object.class);
} else {
MethodInvoker invoker = ObjectUtil.getInvokder(cls, attrName);
if (invoker == null) {
BeetlException be = new BeetlException(BeetlException.GET_CALL_ERROR);
throw be;
}
Class returnCls = invoker.getReturnType();
if (returnCls == Object.class) {
return Type.ObjectType;
} else {
return new Type(returnCls);
}
}
}
use of org.beetl.core.om.MethodInvoker in project beetl2.0 by javamonkey.
the class HasAttributeFunction method call.
@Override
public Object call(Object[] paras, Context ctx) {
Object o = paras[0];
if (o == null) {
throw new NullPointerException();
}
if (o instanceof Map) {
return false;
}
Class type = o.getClass();
for (int i = 1; i < paras.length; i++) {
String key = (String) paras[i];
MethodInvoker invoke = ObjectUtil.getInvokder(type, key);
if (invoke == null) {
return false;
} else if (invoke instanceof GeneralGetMethodInvoker) {
return false;
}
}
return true;
}
Aggregations