de.knightsoftnet.validators.shared.Gln Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mt-bean-validators Show documentation
Show all versions of mt-bean-validators Show documentation
The MT Bean Validators is a collection of JSR-303/JSR-349/JSR-380 bean validators. It's extracted from
GWT Bean Validators and contains no dependencies to GWT.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package de.knightsoftnet.validators.shared;
import de.knightsoftnet.validators.shared.impl.GlnValidator;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.Size;
/**
* The annotated element must be a valid Global Location Number (until 2009 known as International
* Location Number).
* Supported types are Strings, other Objects are transfered to Strings, null
elements
* are considered valid.
* There are numeric, size and checksum tests by apache commons validation routines.
*
* @author Manfred Tremmel
*
*/
@Documented
@Constraint(validatedBy = GlnValidator.class)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE,
ElementType.CONSTRUCTOR, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Size(min = GlnValidator.GLN_LENGTH)
@Digits(integer = GlnValidator.GLN_LENGTH, fraction = 0)
public @interface Gln {
/**
* localized message.
*
* @return localized validation message
*/
String message() default "{de.knightsoftnet.validators.shared.Gln.message}";
/**
* groups to use.
*
* @return array of validation groups
*/
Class>[] groups() default {};
/**
* payload whatever.
*
* @return payload class
*/
Class extends Payload>[] payload() default {};
/**
* Defines several {@code @Gln} annotations on the same element.
*/
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE,
ElementType.CONSTRUCTOR, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@interface List {
/**
* gln value.
*
* @return value
*/
Gln[] value();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy