org.apache.bval.jsr303.ConstraintDescriptorImpl 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 org.apache.bval.jsr303;
import javax.validation.Payload;
import javax.validation.metadata.ConstraintDescriptor;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Description: immutable, serializable implementation of ConstraintDescriptor
* interface of JSR303
* User: roman.stumm
* Date: 22.04.2010
* Time: 10:21:23
*/
public class ConstraintDescriptorImpl implements ConstraintDescriptor, Serializable {
/** Serialization version */
private static final long serialVersionUID = 1L;
private final T annotation;
private final Set> groups;
private final Set> payload;
private final List>> constraintValidatorClasses;
private final Map attributes;
private final Set> composingConstraints;
private final boolean reportAsSingleViolation;
/**
* Create a new ConstraintDescriptorImpl instance.
*
* @param descriptor
*/
public ConstraintDescriptorImpl(ConstraintDescriptor descriptor) {
this(descriptor.getAnnotation(), descriptor.getGroups(), descriptor.getPayload(), descriptor
.getConstraintValidatorClasses(), descriptor.getAttributes(), descriptor.getComposingConstraints(),
descriptor.isReportAsSingleViolation());
}
/**
* Create a new ConstraintDescriptorImpl instance.
*
* @param annotation
* @param groups
* @param payload
* @param constraintValidatorClasses
* @param attributes
* @param composingConstraints
* @param reportAsSingleViolation
*/
public ConstraintDescriptorImpl(T annotation, Set> groups,
Set> payload,
List>> constraintValidatorClasses,
Map attributes, Set> composingConstraints,
boolean reportAsSingleViolation) {
this.annotation = annotation;
this.groups = groups;
this.payload = payload;
this.constraintValidatorClasses = constraintValidatorClasses;
this.attributes = attributes;
this.composingConstraints = composingConstraints;
this.reportAsSingleViolation = reportAsSingleViolation;
}
/**
* {@inheritDoc}
*/
public T getAnnotation() {
return annotation;
}
/**
* {@inheritDoc}
*/
public Set> getGroups() {
return groups;
}
/**
* {@inheritDoc}
*/
public Set> getPayload() {
return payload;
}
/**
* {@inheritDoc}
*/
public List>> getConstraintValidatorClasses() {
return constraintValidatorClasses;
}
/**
* {@inheritDoc}
*/
public Map getAttributes() {
return attributes;
}
/**
* {@inheritDoc}
*/
public Set> getComposingConstraints() {
return composingConstraints;
}
/**
* {@inheritDoc}
*/
public boolean isReportAsSingleViolation() {
return reportAsSingleViolation;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy