org.kiwiproject.validation.Ipv4Address Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kiwi Show documentation
Show all versions of kiwi Show documentation
Kiwi is a utility library. We really like Google's Guava, and also use Apache Commons.
But if they don't have something we need, and we think it is useful, this is where we put it.
package org.kiwiproject.validation;
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.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* The annotated element must have a value that is a valid IPv4 address.
*
* See IPv4 on Wikipedia.
*/
@Documented
@Constraint(validatedBy = {Ipv4AddressValidator.class})
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
public @interface Ipv4Address {
String message() default "{org.kiwiproject.validation.Ipv4Address.message}";
Class>[] groups() default {};
Class extends Payload>[] payload() default {};
/**
* Whether to consider null as valid. The default is false.
*
* @return true to consider null as valid
*/
boolean allowNull() default false;
}