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

br.com.anteros.bean.validation.ConstraintDescriptorImpl Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
/*******************************************************************************
 * Copyright 2012 Anteros Tecnologia
 *  
 * Licensed 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 br.com.anteros.bean.validation;

import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Map;
import java.util.Set;

import br.com.anteros.validation.api.Payload;
import br.com.anteros.validation.api.metadata.ConstraintDescriptor;

/**
 * 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