本文整理匯總了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);
}
}