Java Code Examples for org.apache.commons.beanutils.PropertyUtils.setSimpleProperty()

The following are Jave code examples for showing how to use setSimpleProperty() of the org.apache.commons.beanutils.PropertyUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: yajsw   File: ObservableObject.java   View Source Code Vote up 6 votes
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();
}
  }
 
Example 2
Project: helium   File: TascaFormHelper.java   View Source Code Vote up 5 votes
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);
}
 
Example 3
Project: helium   File: TascaFormController.java   View Source Code Vote up 5 votes
private void afegirVariablesDelProces(Object command, TascaDto tasca) throws Exception {
	InstanciaProcesDto instanciaProces = expedientService.getInstanciaProcesById(
			tasca.getProcessInstanceId(),
			false, false, false);
	PropertyUtils.setSimpleProperty(
			command,
			"procesScope",
			instanciaProces.getVariables());
	
}
 
Example 4
Project: easycode   File: AbstractSqlExecutor.java   View Source Code Vote up 5 votes
/**
 * 在这里加上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);
	}
}