Class CachingTraversableResolver

  • All Implemented Interfaces:
    jakarta.validation.TraversableResolver, CachingRelevant

    public class CachingTraversableResolver
    extends Object
    implements jakarta.validation.TraversableResolver, CachingRelevant
    Cache results of a delegated traversable resovler to optimize calls It works only for a single validate* call and should not be used if the TraversableResolver is accessed concurrently

    Date: 25.11.2009
    Time: 13:56:18

    Author:
    Roman Stumm (based on the code of Emmanuel Bernard)
    • Constructor Summary

      Constructors 
      Constructor Description
      CachingTraversableResolver​(jakarta.validation.TraversableResolver delegate)
      Create a new CachingTraversableResolver instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static jakarta.validation.TraversableResolver cacheFor​(jakarta.validation.TraversableResolver traversableResolver)
      If necessary, return a caching wrapper for the specified TraversableResolver.
      boolean isCascadable​(Object traversableObject, jakarta.validation.Path.Node traversableProperty, Class<?> rootBeanType, jakarta.validation.Path pathToTraversableObject, ElementType elementType)
      boolean isReachable​(Object traversableObject, jakarta.validation.Path.Node traversableProperty, Class<?> rootBeanType, jakarta.validation.Path pathToTraversableObject, ElementType elementType)
      boolean needsCaching()
      Learn whether the results of the TraversableResolver should be cached.
      static boolean needsCaching​(jakarta.validation.TraversableResolver resolver)
      Convenience method to check whether caching is necessary on a given TraversableResolver.
    • Constructor Detail

      • CachingTraversableResolver

        public CachingTraversableResolver​(jakarta.validation.TraversableResolver delegate)
        Create a new CachingTraversableResolver instance.
        Parameters:
        delegate -
    • Method Detail

      • needsCaching

        public static boolean needsCaching​(jakarta.validation.TraversableResolver resolver)
        Convenience method to check whether caching is necessary on a given TraversableResolver.
        Parameters:
        resolver - to check
        Returns:
        true when a CachingTraversableResolver is to be used during validation
      • cacheFor

        public static jakarta.validation.TraversableResolver cacheFor​(jakarta.validation.TraversableResolver traversableResolver)
        If necessary, return a caching wrapper for the specified TraversableResolver.
        Parameters:
        traversableResolver -
        Returns:
        TraversableResolver
        See Also:
        needsCaching(TraversableResolver)
      • isReachable

        public boolean isReachable​(Object traversableObject,
                                   jakarta.validation.Path.Node traversableProperty,
                                   Class<?> rootBeanType,
                                   jakarta.validation.Path pathToTraversableObject,
                                   ElementType elementType)
        Specified by:
        isReachable in interface jakarta.validation.TraversableResolver
      • isCascadable

        public boolean isCascadable​(Object traversableObject,
                                    jakarta.validation.Path.Node traversableProperty,
                                    Class<?> rootBeanType,
                                    jakarta.validation.Path pathToTraversableObject,
                                    ElementType elementType)
        Specified by:
        isCascadable in interface jakarta.validation.TraversableResolver
      • needsCaching

        public boolean needsCaching()
        Learn whether the results of the TraversableResolver should be cached.
        Specified by:
        needsCaching in interface CachingRelevant
        Returns:
        boolean