Class BmCachingTreeFilter
- java.lang.Object
-
- com._1c.g5.v8.dt.navigator.filters.TreeItemFilter
-
- com._1c.g5.v8.dt.navigator.filters.BmCachingTreeFilter
-
- Direct Known Subclasses:
BmPresentTreeFilter
,ContainmentTreeFilter.Absent
,ContainmentTreeFilter.Present
public abstract class BmCachingTreeFilter extends TreeItemFilter
Tree filter with caching and cache invalidation support.
-
-
Constructor Summary
Constructors Constructor Description BmCachingTreeFilter(IBmModel model, boolean recursive)
Instantiates a new BM caching tree filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Disposes this tree item filter.protected IBmModel
getBmModel()
Returns the BM model.protected <T,K>
TgetCached(K key, com.google.common.base.Function<K,T> generator)
Returns the cached value bykey
, calls thegenerator
to compute the value if it is not cached yet.protected void
invalidateOn(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature... features)
Tells this filter to invalidate the cached value at theobject
key, if one of the givenfeatures
of theobject
is changed.protected void
invalidateOn(org.eclipse.emf.ecore.EStructuralFeature... features)
Tells this filter to fully invalidate the cache if one of the providedfeatures
is changed in the context of the associatedIBmModel
.-
Methods inherited from class com._1c.g5.v8.dt.navigator.filters.TreeItemFilter
isRecursive, keep
-
-
-
-
Constructor Detail
-
BmCachingTreeFilter
public BmCachingTreeFilter(IBmModel model, boolean recursive)
Instantiates a new BM caching tree filter.- Parameters:
model
- the model to listen to BM-events on.recursive
- the recursive flag. SeeTreeFilter#TreeFilter(boolean)
.
-
-
Method Detail
-
dispose
public void dispose()
Description copied from class:TreeItemFilter
Disposes this tree item filter.- Overrides:
dispose
in classTreeItemFilter
-
getCached
protected <T,K> T getCached(K key, com.google.common.base.Function<K,T> generator)
Returns the cached value bykey
, calls thegenerator
to compute the value if it is not cached yet.- Parameters:
key
- the cache lookup key.generator
- the generatorFunction
.- Returns:
-
invalidateOn
protected final void invalidateOn(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature... features)
Tells this filter to invalidate the cached value at theobject
key, if one of the givenfeatures
of theobject
is changed.- Parameters:
object
- the object to monitor features of, also acts as the cache key.features
- the features to monitor.
-
invalidateOn
protected final void invalidateOn(org.eclipse.emf.ecore.EStructuralFeature... features)
Tells this filter to fully invalidate the cache if one of the providedfeatures
is changed in the context of the associatedIBmModel
.- Parameters:
features
- the features to monitor.
-
getBmModel
protected final IBmModel getBmModel()
Returns the BM model.- Returns:
- the BM model, never
null
.
-
-