org.apache.commons.beanutils.NestedNullException Java Examples

The following examples show how to use org.apache.commons.beanutils.NestedNullException. 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: ObjectUtils.java    From rice with Educational Community License v2.0 6 votes vote down vote up
/**
 * Return whether or not an attribute is writeable. This method is aware that that Collections may be involved and
 * handles them
 * consistently with the way in which OJB handles specifying the attributes of elements of a Collection.
 *
 * @param object
 * @param property
 * @return
 * @throws IllegalArgumentException
 */
public static boolean isWriteable(Object object, String property,
        PersistenceStructureService persistenceStructureService) throws IllegalArgumentException {
    if (null == object || null == property) {
        throw new IllegalArgumentException("Cannot check writeable status with null arguments.");
    }

	// Try the easy way.
	try {
		if (!(PropertyUtils.isWriteable(object, property))) {
			// If that fails lets try to be a bit smarter, understanding that Collections may be involved.
			return isWriteableHelper(object, property, persistenceStructureService);
		} else {
			return true;
		}
	} catch (NestedNullException nestedNullException) {
		// If a NestedNullException is thrown then the property has a null
		// value.  Call the helper to find the class of the property and
		// get a newInstance of it.
		return isWriteableHelper(object, property, persistenceStructureService);
	}
}
 
Example #2
Source File: CsvExportTupleImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
private Object getObjectValue(final CsvExportColumn column) {
    final String property = column.getName();
    Object rawValue = null;
    try {
        rawValue = PropertyUtils.getNestedProperty(getData(), property);
    } catch (NestedNullException nne) {
        // do not report, it is just null
    } catch (Exception exp) {
        LOG.error("Unable to read property: " + property, exp);
    }
    return rawValue;
}
 
Example #3
Source File: FieldUtils.java    From rice with Educational Community License v2.0 5 votes vote down vote up
private static boolean isPropertyReadable(Object bean, String name) {
    try {
        return PropertyUtils.isReadable(bean, name);
    } catch (NestedNullException e) {
        return false;
    }
}
 
Example #4
Source File: FieldUtils.java    From rice with Educational Community License v2.0 5 votes vote down vote up
private static boolean isPropertyWritable(Object bean, String name) {
    try {
        return PropertyUtils.isWriteable(bean, name);
    } catch (NestedNullException e) {
        return false;
    }
}
 
Example #5
Source File: PojoPluginTest.java    From rice with Educational Community License v2.0 4 votes vote down vote up
public Collection getCollection() {
    throw new NestedNullException();
}