All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.thksystems.validation.beanvalidation.ConditionalNotEmpty Maven / Gradle / Ivy

package de.thksystems.validation.beanvalidation;

import static java.lang.annotation.ElementType.TYPE;
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;

/**
 * The value of the field 'fieldname' must not be empty, if the value of the file 'conditionField' is equal to the 'conditionValue'.
 * 
 * @author Thomas Kuhlmann (kuhl025), arvato D1CS, extern 
 */
@Documented
@Constraint(validatedBy = ConditionalNotEmptyValidator.class)
@Target({ TYPE })
@Retention(RUNTIME)
public @interface ConditionalNotEmpty {
	String message() default "At least one field must have a non-empty value.";

	Class[] groups() default {};

	Class[] payload() default {};

	/** Name of field, must be not empty. */
	String fieldname();

	/** Name of field to check for conditionValue. */
	String conditionField();

	/** If conditionField has conditionValue, the value of the fieldname must not be empty. */
	String conditionValue();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy