Package io.dropwizard.validation
Annotation Interface OneOf
@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy=OneOfValidator.class)
public @interface OneOf
Checks to see that the value is one of a set of elements.
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?>[]
The groups the constraint belongs to.boolean
Whether to ignore case.boolean
Whether to ignore leading and trailing whitespace.The validation message for this constraint.Class<? extends jakarta.validation.Payload>[]
The payloads of this constraint.
-
Element Details
-
value
String[] valueThe set of valid values.- Returns:
- an array containing the valid string values
-
-
-
message
String messageThe validation message for this constraint.- Returns:
- the message
- Default:
- "must be one of {value}"
-
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:
- {}
-
ignoreCase
boolean ignoreCaseWhether to ignore case.- Returns:
- if the case should be ignored
- Default:
- false
-
ignoreWhitespace
boolean ignoreWhitespaceWhether to ignore leading and trailing whitespace.- Returns:
- if leading and trailing whitespaces should be ignored
- Default:
- false
-