Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32204 > unrolled thread
| Started by | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| First post | 2015-07-30 09:52 +0200 |
| Last post | 2015-07-30 21:09 -0400 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
What is the meaning of these two required fields Cecil Westerhof <Cecil@decebal.nl> - 2015-07-30 09:52 +0200
Re: What is the meaning of these two required fields Jeff Higgins <jeff@invalid.invalid> - 2015-07-30 04:49 -0400
Re: What is the meaning of these two required fields Arne Vajhøj <arne@vajhoej.dk> - 2015-07-30 21:09 -0400
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2015-07-30 09:52 +0200 |
| Subject | What is the meaning of these two required fields |
| Message-ID | <87mvyersis.fsf@Equus.decebal.nl> |
I wrote my own annotation:
// public
@Documented
@Constraint(validatedBy = {})
@Target({ FIELD })
@Retention(RUNTIME)
@ReportAsSingleViolation
@NotNull
@Size(min = 1)
public @interface NotEmpty {
// default
Class<?>[] groups() default { };
String message() default "Field should be filled";
Class<? extends Payload>[] payload() default {};
}
I understand the reason for message: that is the message for when
there is a validation constraint.
But what are the reasons for groups and payload?
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2015-07-30 04:49 -0400 |
| Message-ID | <mpcok6$p18$1@dont-email.me> |
| In reply to | #32204 |
On 07/30/2015 03:52 AM, Cecil Westerhof wrote:
> I wrote my own annotation:
> // public
> @Documented
> @Constraint(validatedBy = {})
> @Target({ FIELD })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> @NotNull
> @Size(min = 1)
> public @interface NotEmpty {
> // default
> Class<?>[] groups() default { };
> String message() default "Field should be filled";
> Class<? extends Payload>[] payload() default {};
> }
>
> I understand the reason for message: that is the message for when
> there is a validation constraint.
>
> But what are the reasons for groups and payload?
>
<http://beanvalidation.org/1.1/spec/#constraintsdefinitionimplementation-constraintdefinition-properties>
<http://docs.jboss.org/hibernate/validator/5.1/reference/en-US/html/>
And just ignore the Hibernate extensions if you like.
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2015-07-30 21:09 -0400 |
| Message-ID | <55bacad7$0$296$14726298@news.sunsite.dk> |
| In reply to | #32204 |
On 7/30/2015 3:52 AM, Cecil Westerhof wrote:
> I wrote my own annotation:
> // public
> @Documented
> @Constraint(validatedBy = {})
> @Target({ FIELD })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> @NotNull
> @Size(min = 1)
> public @interface NotEmpty {
> // default
> Class<?>[] groups() default { };
> String message() default "Field should be filled";
> Class<? extends Payload>[] payload() default {};
> }
>
> I understand the reason for message: that is the message for when
> there is a validation constraint.
>
> But what are the reasons for groups and payload?
I believe that the default value can not be null so an empty
array is what is possible.
Arne
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web