Java Code Examples for org.springframework.beans.NotReadablePropertyException

The following examples show how to use org.springframework.beans.NotReadablePropertyException. These examples are extracted from open source projects. 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
@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
@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
@Override
public Object getValue(String paramName) throws IllegalArgumentException {
	try {
		return this.beanWrapper.getPropertyValue(paramName);
	}
	catch (NotReadablePropertyException ex) {
		throw new IllegalArgumentException(ex.getMessage());
	}
}
 
Example 4
@Override
public Object getValue(String paramName) throws IllegalArgumentException {
	try {
		return this.beanWrapper.getPropertyValue(paramName);
	}
	catch (NotReadablePropertyException ex) {
		throw new IllegalArgumentException(ex.getMessage());
	}
}
 
Example 5
@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 Project: rice   Source File: UifViewBeanWrapper.java    License: 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 Project: jdal   Source File: DirectFieldAccessor.java    License: 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);
	}
}