JASONobject 转化实体类时排除其他字段
JsonConfig cfg = new JsonConfig();
cfg.setPropertySetStrategy(new PropertySetStrategy() {
@Override
public void setProperty(Object bean, String key, Object value)
throws JSONException{
try {
PropertyUtils.setNestedProperty(bean, key, value);
}catch(Exception e) {
// 实体类中没有该属性会直接抛异常
}
}
});
cfg.setRootClass(EpDevicemodelIndex.class);
modelIndex = (EpDevicemodelIndex) JSONObject.toBean(jobj, cfg);