public class ValueExtractorResolver extends Object
ValueExtractor
s, and caches for these
extractors based on container types.Modifier and Type | Method and Description |
---|---|
void |
clear() |
ValueExtractorDescriptor |
getMaximallySpecificAndContainerElementCompliantValueExtractor(Class<?> declaredType,
TypeVariable<?> typeParameter)
Used to find the maximally specific and container element compliant value extractor based on the declared type
and the type parameter.
|
ValueExtractorDescriptor |
getMaximallySpecificAndRuntimeContainerElementCompliantValueExtractor(Type declaredType,
TypeVariable<?> typeParameter,
Class<?> runtimeType,
Collection<ValueExtractorDescriptor> valueExtractorCandidates)
Used to find the maximally specific and container element compliant value extractor based on the runtime type.
|
ValueExtractorDescriptor |
getMaximallySpecificValueExtractorForAllContainerElements(Class<?> runtimeType,
Set<ValueExtractorDescriptor> potentialValueExtractorDescriptors)
Used to determine if the passed runtime type is a container and if so return a corresponding maximally specific
value extractor.
|
Set<ValueExtractorDescriptor> |
getMaximallySpecificValueExtractors(Class<?> declaredType)
Used to find all the maximally specific value extractors based on a declared type in the case of value unwrapping.
|
Set<ValueExtractorDescriptor> |
getPotentialValueExtractorCandidatesForCascadedValidation(Type declaredType)
Used to determine the value extractors which potentially could be applied to the runtime type of a given declared type.
|
Set<ValueExtractorDescriptor> |
getValueExtractorCandidatesForCascadedValidation(Type declaredType,
TypeVariable<?> typeParameter)
Used to determine the value extractor candidates valid for a declared type and type variable.
|
Set<ValueExtractorDescriptor> |
getValueExtractorCandidatesForContainerDetectionOfGlobalCascadedValidation(Type enclosingType)
Used to determine the possible value extractors that can be applied to a declared type.
|
public Set<ValueExtractorDescriptor> getMaximallySpecificValueExtractors(Class<?> declaredType)
There might be several of them as there might be several type parameters.
Used for container element constraints.
public ValueExtractorDescriptor getMaximallySpecificAndContainerElementCompliantValueExtractor(Class<?> declaredType, TypeVariable<?> typeParameter)
Used for container element constraints.
ConstraintDeclarationException
- if more than 2 maximally specific container-element-compliant value extractors are foundpublic ValueExtractorDescriptor getMaximallySpecificAndRuntimeContainerElementCompliantValueExtractor(Type declaredType, TypeVariable<?> typeParameter, Class<?> runtimeType, Collection<ValueExtractorDescriptor> valueExtractorCandidates)
The maximally specific one is chosen among the candidates passed to this method.
Used for cascading validation.
ConstraintDeclarationException
- if more than 2 maximally specific container-element-compliant value extractors are foundgetMaximallySpecificAndRuntimeContainerElementCompliantValueExtractor(Type,
TypeVariable, Class, Collection)
public ValueExtractorDescriptor getMaximallySpecificValueExtractorForAllContainerElements(Class<?> runtimeType, Set<ValueExtractorDescriptor> potentialValueExtractorDescriptors)
Obviously, it only works if there's only one value extractor corresponding to the runtime type as we don't precise any type parameter.
There is a special case: when the passed type is assignable to a Map
, the MapValueExtractor
will
be returned. This is required by the Bean Validation specification.
Used for cascading validation when the @Valid
annotation is placed on the whole container.
ConstraintDeclarationException
- if more than 2 maximally specific container-element-compliant value extractors are foundpublic Set<ValueExtractorDescriptor> getValueExtractorCandidatesForCascadedValidation(Type declaredType, TypeVariable<?> typeParameter)
The effective value extractor will be narrowed from these candidates using the runtime type.
Used to optimize the choice of the value extractor in the case of cascading validation.
public Set<ValueExtractorDescriptor> getValueExtractorCandidatesForContainerDetectionOfGlobalCascadedValidation(Type enclosingType)
Used when building cascading metadata in CascadingMetaDataBuilder
to decide if it should be promoted to
ContainerCascadingMetaData
with cascaded constrained type arguments.
An example could be when we need to upgrade BV 1.1 style @Valid private List<SomeBean> list;
to private List<@Valid SomeBean> list;
Searches only for maximally specific value extractors based on a type.
Types that are assignable to Map
are handled as a special case - key value extractor is ignored for them.
public Set<ValueExtractorDescriptor> getPotentialValueExtractorCandidatesForCascadedValidation(Type declaredType)
An example could be when there's a declaration like private PotentiallyContainerAtRuntime<@Valid Bean>;
and there's
no value extractor present for PotentiallyContainerAtRuntime
but there's one available for
Container extends PotentiallyContainerAtRuntime
.
Returned set of extractors is used to determine if at runtime a value extractor can be applied to a runtime type,
and if PotentiallyContainerCascadingMetaData
should be promoted to ContainerCascadingMetaData
.
ValueExtractorDescriptor
s that possibly might be applied to a declaredType
at a runtime.public void clear()
Copyright © 2019 JBoss by Red Hat. All rights reserved.