Class TraversableResolvers
- java.lang.Object
-
- org.hibernate.validator.internal.engine.resolver.TraversableResolvers
-
public class TraversableResolvers extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TraversableResolvergetDefault()Initializes and returns the defaultTraversableResolverdepending on the environment.static TraversableResolverwrapWithCachingForSingleValidation(TraversableResolver traversableResolver, boolean traversableResolverResultCacheEnabled)Potentially wrap theTraversableResolverinto a caching one.
-
-
-
Method Detail
-
getDefault
public static TraversableResolver getDefault()
Initializes and returns the defaultTraversableResolverdepending on the environment.If JPA 2 is present in the classpath, a
JPATraversableResolverinstance is returned.Otherwise, it returns an instance of the default
TraverseAllTraversableResolver.
-
wrapWithCachingForSingleValidation
public static TraversableResolver wrapWithCachingForSingleValidation(TraversableResolver traversableResolver, boolean traversableResolverResultCacheEnabled)
Potentially wrap theTraversableResolverinto a caching one.If
traversableResolverisTraverseAllTraversableResolver.INSTANCE, we don't wrap it and it is returned directly. Same if the caching is explicitly disabled.If
traversableResolveris an instance of ourJPATraversableResolver, we wrap it with a caching wrapper specially tailored for the requirements of the spec. It is a very common case as it is used as soon as we have a JPA implementation in the classpath so optimizing this case is worth it.In all the other cases, we wrap the resolver for caching.
Note that, in the
TraversableResolveris wrapped, a new instance is returned each time and it should be used only for the duration of a validation call.- Returns:
- The resolver for the duration of a validation call.
-
-