Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* 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 org.apache.bval.jsr;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Predicate;
import jakarta.validation.Constraint;
import jakarta.validation.ConstraintTarget;
import jakarta.validation.Payload;
import org.apache.bval.util.Exceptions;
import org.apache.bval.util.ObjectUtils;
import org.apache.bval.util.Validate;
import org.apache.bval.util.reflection.Reflection;
import org.apache.bval.util.reflection.TypeUtils;
import org.apache.commons.weaver.privilizer.Privilizing;
import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
/**
* Defines the well-known attributes of {@link Constraint} annotations.
*
* @version $Rev: 1165923 $ $Date: 2011-09-06 18:07:53 -0500 (Tue, 06 Sep 2011) $
*/
@Privilizing(@CallTo(Reflection.class))
public enum ConstraintAnnotationAttributes {
/**
* "message"
*/
MESSAGE("message", m -> true),
/**
* "groups"
*/
GROUPS("groups", ObjectUtils::isEmptyArray),
/**
* "payload"
*/
PAYLOAD("payload", ObjectUtils::isEmptyArray),
/**
* "validationAppliesTo"
*/
VALIDATION_APPLIES_TO("validationAppliesTo", Predicate.isEqual(ConstraintTarget.IMPLICIT)),
/**
* "value" for multi-valued constraints
*/
VALUE("value", ObjectUtils::isEmptyArray);
@SuppressWarnings("unused")
private static class Types {
String message;
Class>[] groups;
Class extends Payload>[] payload;
Annotation[] value;
ConstraintTarget validationAppliesTo;
}
private static final Set MANDATORY =
Collections.unmodifiableSet(EnumSet.of(ConstraintAnnotationAttributes.MESSAGE,
ConstraintAnnotationAttributes.GROUPS, ConstraintAnnotationAttributes.PAYLOAD));
private final Class> type;
private final String attributeName;
private final Predicate