本文整理汇总了Java中org.apache.commons.beanutils.PropertyUtils.setSimpleProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtils.setSimpleProperty方法的具体用法?Java PropertyUtils.setSimpleProperty怎么用?Java PropertyUtils.setSimpleProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.beanutils.PropertyUtils
的用法示例。
在下文中一共展示了PropertyUtils.setSimpleProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
public void update(String field, Object obj)
{
Object newValue;
try
{
newValue = PropertyUtils.getSimpleProperty(obj, field);
Object oldValue = PropertyUtils.getSimpleProperty(_root, field);
if (oldValue != null && !oldValue.equals(newValue))
{
PropertyUtils.setSimpleProperty(_root, field, newValue);
support.firePropertyChange(field, oldValue, newValue);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例2: setSimpleProperty
import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
private static void setSimpleProperty(
Object command,
String propietatNom,
Object propietatValor) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
logger.debug("Posant valor a propietat del command(" +
"nom=" + propietatNom + ", " +
"valor=" + varValorToString(propietatValor) + ")");
PropertyUtils.setSimpleProperty(
command,
propietatNom,
propietatValor);
}
示例3: afegirVariablesDelProces
import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
private void afegirVariablesDelProces(Object command, TascaDto tasca) throws Exception {
InstanciaProcesDto instanciaProces = expedientService.getInstanciaProcesById(
tasca.getProcessInstanceId(),
false, false, false);
PropertyUtils.setSimpleProperty(
command,
"procesScope",
instanciaProces.getVariables());
}
示例4: save
import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
* 在这里加上entityClass参数,不是无意义的乱加。而是为了后期修改项目代码时,方便全局搜索定位用的
* @param entity
* @param entityClass
* @return
*/
public <K extends Entity> int save(K entity, Class<K> entityClass) {
try {
if (jdbcHandler != null)
jdbcHandler.beforeSave(entity);
List<PkColumn> pks = AnnotateUtils.getPrimaryKeys(entityClass);
boolean sqlIncludePk = true;
for(PkColumn c : pks) {
Object data = PropertyUtils.getSimpleProperty(entity, c.getName());
if(data == null) {
if(c.getIdGeneratorType() != null) {
Object pkVal = IdGenerators.nextVal(c.getIdGeneratorType());
PropertyUtils.setSimpleProperty(entity, c.getName(), pkVal);
}else {
sqlIncludePk = false;
break;
}
}
}
String sql = SqlUtils.getInsertSql(entity,
com.easycodebox.jdbc.config.Configuration.getTable(entityClass),
sqlIncludePk);
return jdbcProcessor.insert(sql(entityClass), sql, null, int.class);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new BaseException("Execute save entity error.", e);
}
}