Concepts for new features

4th release

new annotations

Details about @Expression

in addition to @SkipValidation every annotation of the property-validation module should provide a "skipIf" attribute of type @Expression.

@Required(skipIf = @Expression("#{customer.role eq 'admin'}"))

it should be implemented via a generic approach - that means concrete validation strategies should not check it manually.

moreover, @Expression should provide an attribute which points to the expression evaluator. so it's possible to create custom expressions by providing a custom evaluator. See also the ReferenceResolver idea, maybe expression evaluator could build further on that basis.

the string values are the final values for the parameter.in the warn vs. error example the *Level interfaces tell e.g. a custom ParameterProcessor how to handle the provided information.the postfix is e.g. a postfix for the message-key

brainstorming - ideas in progress

reference resolver

Add the possibility of a Custom reference resolver for cross validation.

With the cross validation annotations, the developer can specify an expression to identify the other value(s) used for validation. At this moment EL expressions and a limited version of Java variable notation is allowed.

With the addition of a ReferenceResolver interface, (some default implementations for EL and (full) Java variable notations could be foreseen) it allows the developer to implement their own resolving mechanism or notations.

The annotations used in Cross field validation will have an additional property resolverClass by default as follows

There is another extension point for the developers, the DefaultExtvalReferenceResolver. It has a list of ReferenceGrammar 's (contains by default the EL and Java variable notations). The developers can add their own 'grammars' so custom notations can be developed to allow something like bean->property%indexList%.

The grammars have the InvocationOrder attribute so custom, developers made, grammars could be placed before or after the default ones. The order is important since the first grammar that is found to understand the reference, is used the evaluate it.

For backward compatibility the DefaultExtvalReferenceResolver.class is taken as reference resolver when the property resolverClass isn't found on the cross validation annotation.