[bv-dev] Making @ValidateExecutable easier to use on methods

Emmanuel Bernard emmanuel at hibernate.org
Mon Feb 11 05:04:42 EST 2013


Santiago from the JAX-RS EG is concerned that we have created an
over-engineered solution to enable / disable method validation on a per
method basis.
We have good reasons for it but I am wondering if we can make it a bit
easier to enable or disable methods out of the box.

Remember, the default is to ignore getters. If we make
@ValidateExecutable.type default to ALL, enabling it on a getter would
be

    @NotEmpty @ValidateExecutable
    public String getAction() {...}

instead of 


    @NotEmpty @ValidateExecutable(type=ExecutableType.ALL)
    public String getAction() {...}

We would still need the verbose approach to disable validation

    @NotEmpty @ValidateExecutable(type=ExecutableType.NONE)
    public String getAction() {...}

I am open to suggestions to make that easier on methods. I don't think
an additional annotation will make anything easier

Maybe renaming NONE with OFF might help? It's a bit weirder on a
class-level but that might work.

Thoughts?

Emmanuel


More information about the beanvalidation-dev mailing list