Package io.dropwizard.validation
Annotation Interface 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 on
Duration instances.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines several@DurationRangeannotations on the same element. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?>[]The groups the constraint belongs to.longThe maximum value of the range the validatedDurationmust be in.The validation message for this constraint.longThe minimum value of the range the validatedDurationmust be in.Class<? extends jakarta.validation.Payload>[]The payloads of this constraint.The unit of the validated range.
-
Element Details
-
min
The minimum value of the range the validatedDurationmust be in.- Returns:
- the minimum value
- Default:
- 0L
-
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 unitThe unit of the validated range.- Returns:
- the
TimeUnit
- Default:
- SECONDS
-
message
String messageThe validation message for this constraint.- Returns:
- the message
- Default:
- "must be between {min} {unit} and {max} {unit}"
-
groups
Class<?>[] groupsThe groups the constraint belongs to.- Returns:
- an array of classes representing the groups
- Default:
- {}
-
payload
Class<? extends jakarta.validation.Payload>[] payloadThe payloads of this constraint.- Returns:
- the array of payload classes
- Default:
- {}
-