io.airlift.configuration.validation.FileExists Maven / Gradle / Ivy
package io.airlift.configuration.validation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
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.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* The annotated element must represent a file location which exists.
* Supported types are:
*
* - {@code Path}
* - {@code File}
* - {@code String}
*
*
* Note that constraint message is ignored as it's created by {@code FileExistsValidator}.
*/
@Target({FIELD, METHOD, PARAMETER, ANNOTATION_TYPE, TYPE_USE})
@Retention(RUNTIME)
@Constraint(validatedBy = FileExistsValidator.class)
@Documented
public @interface FileExists
{
String message() default "";
Class>[] groups() default { };
Class extends Payload>[] payload() default { };
}