Package io.dropwizard.validation
Annotation Type DurationRange
-
@Documented @Constraint(validatedBy={}) @Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE}) @Retention(RUNTIME) @MinDuration(0L) @MaxDuration(value=9223372036854775807L, unit=DAYS) @ReportAsSingleViolation public @interface DurationRange
The annotated element has to be in the appropriate range. Apply onDurationinstances.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Class<?>[]groupsThe groups the constraint belongs to.longmaxThe maximum value of the range the validatedDurationmust be in.StringmessageThe validation message for this constraint.longminThe minimum value of the range the validatedDurationmust be in.Class<? extends jakarta.validation.Payload>[]payloadThe payloads of this constraint.TimeUnitunitThe unit of the validated range.
-
-
-
Element Detail
-
min
@OverridesAttribute(constraint=MinDuration.class, name="value") long min
The minimum value of the range the validatedDurationmust be in.- Returns:
- the minimum value
- Default:
- 0L
-
-
-
max
@OverridesAttribute(constraint=MaxDuration.class, name="value") long max
The maximum value of the range the validatedDurationmust be in.- Returns:
- the maximum value
- Default:
- 9223372036854775807L
-
-
-
unit
@OverridesAttribute(constraint=MinDuration.class,name="unit") @OverridesAttribute(constraint=MaxDuration.class,name="unit") TimeUnit unit
The unit of the validated range.- Returns:
- the
TimeUnit
- Default:
- java.util.concurrent.TimeUnit.SECONDS
-
-
-
message
String message
The validation message for this constraint.- Returns:
- the message
- Default:
- "must be between {min} {unit} and {max} {unit}"
-
-
-
groups
Class<?>[] groups
The groups the constraint belongs to.- Returns:
- an array of classes representing the groups
- Default:
- {}
-
-
-
payload
Class<? extends jakarta.validation.Payload>[] payload
The payloads of this constraint.- Returns:
- the array of payload classes
- Default:
- {}
-
-