Class DependencyTreeCache<T>

  • Type Parameters:
    T - the value type
    All Implemented Interfaces:
    Serializable

    public class DependencyTreeCache<T>
    extends Object
    implements Serializable
    A caching tree traverser for collecting and parsing dependencies.

    For internal use only. May be renamed or removed in a future release.

    Since:
    1.2
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Constructor Detail

      • DependencyTreeCache

        public DependencyTreeCache​(SerializableFunction<T,​Collection<T>> dependencyParser)
        Creates a dependency cache with the given dependency parser.
        Parameters:
        dependencyParser - a potentially slow callback function that finds the direct dependencies for any given value
    • Method Detail

      • getDependencies

        public Set<T> getDependencies​(T node)
        Collects all transitive dependencies of the given node, including the node itself.
        Parameters:
        node - the node for which to collect dependencies
        Returns:
        the transitive dependencies of the given node
      • clear

        public void clear()
        Clears all the contents of the cache. A lookup that is in progress while the cache is cleared may return a result that combines previously cached dependencies with newly parsed dependencies.