NotWritablePropertyException class

The error a BeanWrapper throws when a property path cannot be written.

The property does not exist or is read-only (a final field), the class is not @Introspected, or the index is invalid. BeanWrapper.setPropertyValues skips these with ignoreUnknown, which is how data binding ignores request fields the target does not have.

try {
  BeanWrapper(person).setPropertyValue('id', 'p2'); // final field
} on NotWritablePropertyException catch (e) {
  log.warning(e.message); // ... 'id' of Person: read-only
}

Spring (Java):

try {
  new BeanWrapperImpl(person).setPropertyValue("id", "p2");
} catch (NotWritablePropertyException e) {
  log.warn(e.getMessage());
}
Inheritance

Constructors

NotWritablePropertyException(Type beanType, String propertyName, [String? reason])
The path propertyName of a beanType cannot be written; the optional reason says why (default: "not writable").

Properties

beanType → Type
The type of the wrapped (root) object.
final
cause → Object?
The error that caused this one, if any: what a constructor threw, or the container error of a nested bean.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
message → String
A human-readable description of the problem.
finalinherited
mostSpecificCause → Object
rootCause, or this exception when it has no cause. Spring: getMostSpecificCause().
no setterinherited
propertyName → String
The full property path that failed.
final
rootCause → Object?
The innermost cause: cause followed through nested container errors, or null without a cause. Usually the error that really went wrong. Spring: getRootCause().
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited