Class DependencyCache<T extends ProjectNode>


  • public class DependencyCache<T extends ProjectNode>
    extends Object
    Allows to request and cache dependencies of a project file to one or several other project nodes. The request is defined by a dependency name, and by the type of the "target" nodes.

    The objects are cached when retrieved, and will not be fetched again until invalidation of the cache.

    Author:
    Geoffroy Jamgotchian
    • Constructor Detail

      • DependencyCache

        public DependencyCache​(ProjectFile projectFile,
                               String dependencyName,
                               Class<T> dependencyClass)
    • Method Detail

      • invalidate

        public void invalidate()
        Invalidates the cache: dependencies will be fetched again on next request.
      • getFirst

        public Optional<T> getFirst()
        Gets the first dependency of the project file which matches the specified dependency name and class. Result is cached, and will not be fetched again until the cache is invalidated.
      • getAll

        public List<T> getAll()
        Gets all the dependencies of the project file which match the specified dependency name and class. Result is cached, and will not be fetched again until the cache is invalidated.