Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Non-empty default groups
PostPosted: Mon Nov 14, 2016 9:59 pm 
Newbie

Joined: Mon Nov 14, 2016 9:51 pm
Posts: 1
I want to make annotations that are already 'grouped' to increase readability (decrease visual noise). The name of the Constraint Annotation is already extremely clear for when the validation will occur.

Specifically:

Code:
   @RequiredForCreateAttribute
   @UpdatableAttribute(false)
   public String getKey() {
      return key;
   }


is easier to use and read for me than this:

Code:
   @NotNull(groups = CreateValidation.class)
   @Null(groups = UpdateValidation.class)
   public String getKey() {
      return key;
   }


Where RequiredForCreateAttribute and UpdatableAttribute are Constraints that have attributes like:

Code:
   Class<?>[] groups() default { CreateValidation.class };

or
Code:
   Class<?>[] groups() default { UpdateValidation.class };


Is it possible to consider allowing this in a future version, or is there a great reason why groups must default to an empty list?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.