Top Description Fields Constructors Methods
org.hibernate.validator.internal.metadata

public Class BeanMetaDataManagerImpl

extends Object
implements BeanMetaDataManager
Class Inheritance
All Implemented Interfaces
org.hibernate.validator.internal.metadata.BeanMetaDataManager
Static Imports
org.hibernate.validator.internal.util.CollectionHelper.newArrayList, .ConcurrentReferenceHashMap.Option.IDENTITY_COMPARISONS, .ConcurrentReferenceHashMap.ReferenceType.SOFT, org.hibernate.validator.internal.util.logging.Messages.MESSAGES

This manager is in charge of providing all constraint related meta data required by the validation engine.

Actual retrieval of meta data is delegated to MetaDataProvider implementations which load meta-data based e.g. based on annotations or XML.

For performance reasons a cache is used which stores all meta data once loaded for repeated retrieval. Upon initialization this cache is populated with meta data provided by the given eager providers. If the cache doesn't contain the meta data for a requested type it will be retrieved on demand using the annotation based provider.

Authors
Gunnar Morling, Chris Beckey <[email protected]>, Guillaume Smet

Field Summary

Modifier and TypeField and Description
private final ConcurrentReferenceHashMap<Class<?>, BeanMetaData<?>>
beanMetaDataCache

Used to cache the constraint meta data for validated entities

private final BeanMetaDataClassNormalizer
private final ConstraintCreationContext
constraintCreationContext

The constraint creation context containing all the helpers necessary to the constraint creation.

private static final int
DEFAULT_CONCURRENCY_LEVEL

The default concurrency level for this cache.

private static final int
DEFAULT_INITIAL_CAPACITY

The default initial capacity for this cache.

private static final float
DEFAULT_LOAD_FACTOR

The default load factor for this cache.

private final ExecutableHelper
executableHelper

Used for resolving type parameters.

private final List<MetaDataProvider>
metaDataProviders

Additional metadata providers used for meta data retrieval if the XML and/or programmatic configuration is used.

private final MethodValidationConfiguration
methodValidationConfiguration

the three properties in this field affect the invocation of rules associated to section 4.5.5 of the specification.

private final ExecutableParameterNameProvider
private final ValidationOrderGenerator

Constructor Summary

AccessConstructor and Description
public
BeanMetaDataManagerImpl(ConstraintCreationContext constraintCreationContext, ExecutableHelper executableHelper, ExecutableParameterNameProvider parameterNameProvider, JavaBeanHelper javaBeanHelper, BeanMetaDataClassNormalizer beanMetaDataClassNormalizer, ValidationOrderGenerator validationOrderGenerator, List<MetaDataProvider> optionalMetaDataProviders, MethodValidationConfiguration methodValidationConfiguration)

Method Summary

Modifier and TypeMethod and Description
public void
private <
The type of interest.
T
>
BeanMetaDataImpl<T>

Returns:

A bean meta data object for the given type.
createBeanMetaData
(Class<T>
The type's class.
clazz
)

Creates a org.hibernate.validator.internal.metadata.aggregated.BeanMetaData containing the meta data from all meta data providers for the given type and its hierarchy.

private AnnotationProcessingOptions

Returns:

returns the annotation ignores from the non annotation based meta data providers
getAnnotationProcessingOptionsFromNonDefaultProviders
(List<MetaDataProvider> optionalMetaDataProviders)

private <
The type of the class to get the configurations for.
T
>
List<BeanConfiguration<? super T>>

Returns:

A set with the configurations for the complete hierarchy of the given type. May be empty, but never null.
getBeanConfigurationForHierarchy
(MetaDataProvider provider, Class<T>
The type of interest.
beanClass
)

Returns a list with the configurations for all types contained in the given type's hierarchy (including implemented interfaces) starting at the specified type.

public <T> BeanMetaData<T>
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanMetaDataCacheback to summary
private final ConcurrentReferenceHashMap<Class<?>, BeanMetaData<?>> beanMetaDataCache

Used to cache the constraint meta data for validated entities

beanMetaDataClassNormalizerback to summary
private final BeanMetaDataClassNormalizer beanMetaDataClassNormalizer
constraintCreationContextback to summary
private final ConstraintCreationContext constraintCreationContext

The constraint creation context containing all the helpers necessary to the constraint creation.

DEFAULT_CONCURRENCY_LEVELback to summary
private static final int DEFAULT_CONCURRENCY_LEVEL

The default concurrency level for this cache.

DEFAULT_INITIAL_CAPACITYback to summary
private static final int DEFAULT_INITIAL_CAPACITY

The default initial capacity for this cache.

DEFAULT_LOAD_FACTORback to summary
private static final float DEFAULT_LOAD_FACTOR

The default load factor for this cache.

executableHelperback to summary
private final ExecutableHelper executableHelper

Used for resolving type parameters. Thread-safe.

metaDataProvidersback to summary
private final List<MetaDataProvider> metaDataProviders

Additional metadata providers used for meta data retrieval if the XML and/or programmatic configuration is used.

Annotations
@Immutable
methodValidationConfigurationback to summary
private final MethodValidationConfiguration methodValidationConfiguration

the three properties in this field affect the invocation of rules associated to section 4.5.5 of the specification. By default they are all false, if true they allow for relaxation of the Liskov Substitution Principal.

parameterNameProviderback to summary
private final ExecutableParameterNameProvider parameterNameProvider
validationOrderGeneratorback to summary
private final ValidationOrderGenerator validationOrderGenerator

Constructor Detail

BeanMetaDataManagerImplback to summary
public BeanMetaDataManagerImpl(ConstraintCreationContext constraintCreationContext, ExecutableHelper executableHelper, ExecutableParameterNameProvider parameterNameProvider, JavaBeanHelper javaBeanHelper, BeanMetaDataClassNormalizer beanMetaDataClassNormalizer, ValidationOrderGenerator validationOrderGenerator, List<MetaDataProvider> optionalMetaDataProviders, MethodValidationConfiguration methodValidationConfiguration)

Method Detail

clearback to summary
public void clear()

Implements org.hibernate.validator.internal.metadata.BeanMetaDataManager.clear.

Annotations
@Override
createBeanMetaDataback to summary
private <T> BeanMetaDataImpl<T> createBeanMetaData(Class<T> clazz)

Creates a org.hibernate.validator.internal.metadata.aggregated.BeanMetaData containing the meta data from all meta data providers for the given type and its hierarchy.

Parameters
<T>
The type of interest.
clazz:Class<T>

The type's class.

Returns:BeanMetaDataImpl<T>

A bean meta data object for the given type.

getAnnotationProcessingOptionsFromNonDefaultProvidersback to summary
private AnnotationProcessingOptions getAnnotationProcessingOptionsFromNonDefaultProviders(List<MetaDataProvider> optionalMetaDataProviders)
Returns:AnnotationProcessingOptions

returns the annotation ignores from the non annotation based meta data providers

getBeanConfigurationForHierarchyback to summary
private <T> List<BeanConfiguration<? super T>> getBeanConfigurationForHierarchy(MetaDataProvider provider, Class<T> beanClass)

Returns a list with the configurations for all types contained in the given type's hierarchy (including implemented interfaces) starting at the specified type.

Parameters
<T>
The type of the class to get the configurations for.
beanClass:Class<T>

The type of interest.

Returns:List<BeanConfiguration<? super T>>

A set with the configurations for the complete hierarchy of the given type. May be empty, but never null.

getBeanMetaDataback to summary
public <T> BeanMetaData<T> getBeanMetaData(Class<T> beanClass)

Implements org.hibernate.validator.internal.metadata.BeanMetaDataManager.getBeanMetaData.

Annotations
@Override
@SuppressWarnings:unchecked
numberOfCachedBeanMetaDataInstancesback to summary
public int numberOfCachedBeanMetaDataInstances()