com.github.ldeitos.constraint.NotNull Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of extendedValidation-core Show documentation
Show all versions of extendedValidation-core Show documentation
Extension for BeanValidation API Core. Content interfaces, qualifiers and constraints definitions.
This version is Java 17 and JakartaEE 10 compatible.
package com.github.ldeitos.constraint;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.ReportAsSingleViolation;
/**
* The annotated element must not be {@code null}.
* Accepts any type.
*
* @author Emmanuel Bernard
*/
@javax.validation.constraints.NotNull
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@Retention(RUNTIME)
@Constraint(validatedBy = {})
@ReportAsSingleViolation()
@Documented
public @interface NotNull {
String message() default "{javax.validation.constraints.NotNull.message}";
/**
* @return Parameter array to be interpolated at message. Parameters can be informed in
* "key=value" or just "value" pattern.
* e.g:
*
* message="My {par1} message"
* messageParameters = {"par1=parameterized"}
*
* message="My {0} message"
* messageParameters = {"parameterized"}
*/
String[] messageParameters() default {};
Class>[] groups() default {};
Class extends Payload>[] payload() default {};
/**
* Defines several {@link NotNull} annotations on the same element.
*
* @see com.github.ldeitos.constraint.NotNull
*/
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
@interface List {
NotNull[] value();
}
}