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

de.knightsoftnet.validators.shared.Url Maven / Gradle / Ivy

/*
 * 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.UrlValidator;

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.Size;

/**
 * The annotated element must be a valid url.
* Supported types are Strings, other Objects are transfered to Strings, null elements * are considered valid.
* There are format tests, domain validity tests, and size checks by apache commons validation * routines.
* * @author Manfred Tremmel * */ @Documented @Constraint(validatedBy = UrlValidator.class) @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Size(max = UrlValidator.LENGTH_URL) public @interface Url { /** * localized messages, do not implement ourself, use the hibernate texts. * * @return localized validation message */ String message() default "{org.hibernate.validator.constraints.URL.message}"; /** * groups to use. * * @return array of validation groups */ Class[] groups() default {}; /** * payload whatever. * * @return payload class */ Class[] payload() default {}; /** * Defines several {@code @URL} annotations on the same element. */ @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented @interface List { /** * URL value. * * @return value */ Url[] value(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy