JSR303's payload attribute values are limited to class references.
The idea is to allow the specification of an additional String value for each payload declaration allowing more flexible configurations.
For example:
{code} public @interface Payload { Class< ? > type(); String value(); } {code} {code} @interface MinLength { Payload[] payload() default {}; // ... } {code} {code} class Account { @MinLength(value=4, payload = { @Payload(type=ErrorCode.class, value="1234"), @Payload(type=When.class, value="groovy:this.owner != null && this.foobar > 3") }) String name; } {code}
|