org.xson.web.ognl.Ognl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xco-web Show documentation
Show all versions of xco-web Show documentation
xco-web is an easy to use control layer framework, is part of the SOA system, using xml language to describe the controller.
The newest version!
package org.xson.web.ognl;
import java.util.Map;
import org.xson.common.object.XCO;
import org.xson.web.ognl.map.OgnlMap;
import org.xson.web.ognl.var.VariableVo;
import org.xson.web.ognl.xco.OgnlXCO;
public class Ognl {
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void setValue(Object container, String key, Object value) {
if (null == container) {
return;
}
if (XCO.class == container.getClass()) {
((XCO) container).setObjectValue(key, value);
} else if (Map.class.isAssignableFrom(container.getClass())) {
((Map) container).put(key, value);
} else {
throw new OgnlException("Ognl.setValue不支持的类型:" + container.getClass());
}
}
@SuppressWarnings("unchecked")
public static Object getValue(Object container, VariableVo varVo) {
if (null == container) {
return null;
}
if (XCO.class == container.getClass()) {
return OgnlXCO.getValue((XCO) container, varVo);
} else if (Map.class.isAssignableFrom(container.getClass())) {
return OgnlMap.getValue((Map) container, varVo);
} else {
throw new OgnlException("Ognl.getValue不支持的类型:" + container.getClass());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy