[bv-dev] Questions from BV spec 2.0 public draft

Matt Benson mbenson at apache.org
Wed Apr 26 08:35:26 EDT 2017


On Apr 26, 2017 4:13 AM, "Guillaume Smet" <guillaume.smet at gmail.com> wrote:

Hi,

On Wed, Apr 26, 2017 at 10:40 AM, Gunnar Morling <gunnar at hibernate.org>
wrote:

> > * Should there be a common superinterface for
> > Path$[BeanNode|PropertyNode|ContainerElementNode], all of which define
> > the same methods?
>
> I've been wondering the same, but come to think that it doesn't give you
> much.
>
> You (as a user) are going to work with specific node types (as
> narrowed down via getKind() + as()), so I would not expect you to deal
> with that super-type in your code. It'd put the declaration of those
> methods into one place, which is nice, though I kinda like the
> simplicity of the current Node hierarchy, with one specific sub-type
> per kind.
>
> What do others think?
>

I had the exact same reasoning when I did it.

> * Should Positive/Negative#strict() default true be provided as
> > #orZero() default false, for commonality with
> > [Past|Future]#orPresent() ?
>
> Hum, yes, good point. I think I'd prefer that.
>
> @Emmanuel, I vaguely remember we discussed this. Did you see a good
> reason for the current default?
>
> @All, what do you think?
>

Matt, do you just want to change the name or also to change the default?


I was speaking only of the name; however this illustrates that people may
have different expectations about what the default strict behavior would
be. #orZero() is pretty explicit.

Matt


Currently, it's:
boolean strict() default false;
and you are supposing the default is true in your question.

Currently, we have:
- Positive/Negative: strict() default false;
- DecimalMin/DecimalMax: inclusive() default true;
- Past/Present: orPresent() default false;

I thought about proposing orZero() at the time but I didn't suggest it
because "strictly positive" makes sense.

Being strict by default would probably make more sense.

As for the name, I'm torn.

-- 
Guillaume

_______________________________________________
beanvalidation-dev mailing list
beanvalidation-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20170426/795ac905/attachment.html 


More information about the beanvalidation-dev mailing list