Class TraversableResolvers
-
Method Summary
Modifier and TypeMethodDescriptionstatic TraversableResolver
Initializes and returns the defaultTraversableResolver
depending on the environment.static TraversableResolver
wrapWithCachingForSingleValidation
(TraversableResolver traversableResolver, boolean traversableResolverResultCacheEnabled) Potentially wrap theTraversableResolver
into a caching one.
-
Method Details
-
getDefault
Initializes and returns the defaultTraversableResolver
depending on the environment.If JPA 2 is present in the classpath, a
JPATraversableResolver
instance is returned.Otherwise, it returns an instance of the default
TraverseAllTraversableResolver
. -
wrapWithCachingForSingleValidation
public static TraversableResolver wrapWithCachingForSingleValidation(TraversableResolver traversableResolver, boolean traversableResolverResultCacheEnabled) Potentially wrap theTraversableResolver
into a caching one.If
traversableResolver
isTraverseAllTraversableResolver.INSTANCE
, we don't wrap it and it is returned directly. Same if the caching is explicitly disabled.If
traversableResolver
is 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
TraversableResolver
is 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.
-