Java Code Examples for org.springframework.beans.ConfigurablePropertyAccessor#isWritableProperty()

The following examples show how to use org.springframework.beans.ConfigurablePropertyAccessor#isWritableProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeanPropertiesMapper.java    From onetwo with Apache License 2.0 5 votes vote down vote up
protected void setPropertyValue(Object obj, ConfigurablePropertyAccessor bw, String propertyName, Object value){
	if(!bw.isWritableProperty(propertyName)){
		if(!ignoreNotFoundProperty){
			throw new NoSuchElementException("no setter found for property: " + propertyName+", target: " + obj);
		}
		logger.debug("ignore property: {}={} ", propertyName, value);
		return ;
	}
	bw.setPropertyValue(propertyName, value);
	if(logger.isDebugEnabled()){
		logger.debug("set property: {}={} ", propertyName, value);
	}
}
 
Example 2
Source File: ConfigableBeanMapper.java    From onetwo with Apache License 2.0 5 votes vote down vote up
protected void setPropertyValue(Object obj, ConfigurablePropertyAccessor bw, String propertyName, Object value){
	if(!bw.isWritableProperty(propertyName)){
		if(!ignoreNotFoundProperty){
			throw new NoSuchElementException("no setter found for property: " + propertyName+", target: " + obj);
		}
		logger.debug("ignore property: {}={} ", propertyName, value);
		return ;
	}
	bw.setPropertyValue(propertyName, value);
	if(logger.isDebugEnabled()){
		logger.debug("set property: {}={} ", propertyName, value);
	}
}
 
Example 3
Source File: GrailsDataBinder.java    From AlgoTrader with GNU General Public License v2.0 4 votes vote down vote up
private boolean isNullAndWritableProperty(ConfigurablePropertyAccessor accessor, String propertyName) {
	return accessor.isWritableProperty(propertyName) && (accessor.isReadableProperty(propertyName) && accessor.getPropertyValue(propertyName) == null);
}