org.hibernate.validator.internal.metadata.aggregated.CascadingMetaData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bean-validator Show documentation
Show all versions of bean-validator Show documentation
JSR 380's RI, Hibernate Validator version ${hibernate-validator.version} and its dependencies repackaged as OSGi bundle
/*
* Hibernate Validator, declare and validate application constraints
*
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or .
*/
package org.hibernate.validator.internal.metadata.aggregated;
import java.lang.reflect.TypeVariable;
import java.util.Set;
import javax.validation.metadata.GroupConversionDescriptor;
import javax.validation.valueextraction.ValueExtractor;
import org.hibernate.validator.internal.engine.valueextraction.AnnotatedObject;
import org.hibernate.validator.internal.engine.valueextraction.ArrayElement;
import org.hibernate.validator.internal.engine.valueextraction.ValueExtractorManager;
/**
* An aggregated view of the cascading validation metadata. Note that it also includes the cascading validation metadata
* defined on the root element via the {@link ArrayElement} and {@link AnnotatedObject} pseudo type parameters.
*
* To reduce the memory footprint, {@code CascadingMetaData} comes in 2 variants:
*
* - {@link NonContainerCascadingMetaData} dedicated to non containers: it is very lightweight;
* - {@link ContainerCascadingMetaData} used for containers: it is the full featured version.
*
*
* @author Guillaume Smet
*/
public interface CascadingMetaData {
TypeVariable getTypeParameter();
boolean isCascading();
boolean isMarkedForCascadingOnAnnotatedObjectOrContainerElements();
Class convertGroup(Class originalGroup);
Set getGroupConversionDescriptors();
boolean isContainer();
T as(Class clazz);
/**
* Add additional cascading metadata when:
*
* - the element is marked with {@code @Valid},
* - the runtime type of the element is container based (e.g. collections, maps or arrays),
* - and there are {@link ValueExtractor}s present for such container,
* - and the declared type isn't container based.
*
*
* An example of this particular situation is: {@code @Valid private Object element = new ArrayList()}.
*
* Note that if the declared type is container based, the cascading information is directly included at bootstrap
* time.
*/
CascadingMetaData addRuntimeContainerSupport(ValueExtractorManager valueExtractorManager, Class valueClass);
}