org.springframework.beans.NotReadablePropertyException Java Examples

The following examples show how to use org.springframework.beans.NotReadablePropertyException. 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: BeanPropertySqlParameterSource.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
@Nullable
public Object getValue(String paramName) throws IllegalArgumentException {
	try {
		return this.beanWrapper.getPropertyValue(paramName);
	}
	catch (NotReadablePropertyException ex) {
		throw new IllegalArgumentException(ex.getMessage());
	}
}
 
Example #2
Source File: BeanPropertySqlParameterSource.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
@Nullable
public Object getValue(String paramName) throws IllegalArgumentException {
	try {
		return this.beanWrapper.getPropertyValue(paramName);
	}
	catch (NotReadablePropertyException ex) {
		throw new IllegalArgumentException(ex.getMessage());
	}
}
 
Example #3
Source File: BeanPropertySqlParameterSource.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object getValue(String paramName) throws IllegalArgumentException {
	try {
		return this.beanWrapper.getPropertyValue(paramName);
	}
	catch (NotReadablePropertyException ex) {
		throw new IllegalArgumentException(ex.getMessage());
	}
}
 
Example #4
Source File: BeanPropertySqlParameterSource.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public Object getValue(String paramName) throws IllegalArgumentException {
	try {
		return this.beanWrapper.getPropertyValue(paramName);
	}
	catch (NotReadablePropertyException ex) {
		throw new IllegalArgumentException(ex.getMessage());
	}
}
 
Example #5
Source File: BeanPropertySqlParameterSource.java    From effectivejava with Apache License 2.0 5 votes vote down vote up
@Override
public Object getValue(String paramName) throws IllegalArgumentException {
	try {
		return this.beanWrapper.getPropertyValue(paramName);
	}
	catch (NotReadablePropertyException ex) {
		throw new IllegalArgumentException(ex.getMessage());
	}
}
 
Example #6
Source File: UifViewBeanWrapper.java    From rice with Educational Community License v2.0 5 votes vote down vote up
/**
 * Checks whether the given property is secure.
 *
 * @param wrappedClass class the property is associated with
 * @param propertyPath path to the property
 * @return boolean true if the property is secure, false if not
 */
protected boolean isSecure(Class<?> wrappedClass, String propertyPath) {
    if (KRADUtils.isSecure(propertyPath, wrappedClass)) {
        return true;
    }

    // since this is part of a set, we want to make sure nested paths grow
    setAutoGrowNestedPaths(true);

    BeanWrapperImpl beanWrapper;
    try {
        beanWrapper = getBeanWrapperForPropertyPath(propertyPath);
    } catch (NotReadablePropertyException | NullValueInNestedPathException e) {
        LOG.debug("Bean wrapper was not found for " + propertyPath
                + ", but since it cannot be accessed it will not be set as secure.", e);
        return false;
    }

    if (org.apache.commons.lang.StringUtils.isNotBlank(beanWrapper.getNestedPath())) {
        PropertyTokenHolder tokens = getPropertyNameTokens(propertyPath);
        String nestedPropertyPath = org.apache.commons.lang.StringUtils.removeStart(tokens.canonicalName,
                beanWrapper.getNestedPath());

        return isSecure(beanWrapper.getWrappedClass(), nestedPropertyPath);
    }

    return false;
}
 
Example #7
Source File: DirectFieldAccessor.java    From jdal with Apache License 2.0 5 votes vote down vote up
@Override
public Object getPropertyValue(String propertyName) throws BeansException {
	Field field = this.fieldMap.get(propertyName);
	if (field == null) {
		throw new NotReadablePropertyException(
				this.target.getClass(), propertyName, "Field '" + propertyName + "' does not exist");
	}
	try {
		ReflectionUtils.makeAccessible(field);
		return field.get(this.target);
	}
	catch (IllegalAccessException ex) {
		throw new InvalidPropertyException(this.target.getClass(), propertyName, "Field is not accessible", ex);
	}
}