Package com.powsybl.afs
Class DependencyCache<T extends ProjectNode>
- java.lang.Object
-
- com.powsybl.afs.DependencyCache<T>
-
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 Summary
Constructors Constructor Description DependencyCache(ProjectFile projectFile, String dependencyName, Class<T> dependencyClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>
getAll()
Gets all the dependencies of the project file which match the specified dependency name and class.Optional<T>
getFirst()
Gets the first dependency of the project file which matches the specified dependency name and class.void
invalidate()
Invalidates the cache: dependencies will be fetched again on next request.
-
-
-
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.
-
-