public abstract class CachedValuesManager
extends java.lang.Object
CachedValue
objects.
By default cached values are stored in the user data of associated objects implementing UserDataHolder
.Constructor and Description |
---|
CachedValuesManager() |
Modifier and Type | Method and Description |
---|---|
<T> CachedValue<T> |
createCachedValue(CachedValueProvider<T> provider)
Creates a new CachedValue instance with the given provider.
|
abstract <T> CachedValue<T> |
createCachedValue(CachedValueProvider<T> provider,
boolean trackValue)
Creates new CachedValue instance with given provider.
|
abstract <T,P> ParameterizedCachedValue<T,P> |
createParameterizedCachedValue(ParameterizedCachedValueProvider<T,P> provider,
boolean trackValue) |
static <T> T |
getCachedValue(PsiElement psi,
CachedValueProvider<T> provider)
Create a cached value with the given provider and non-tracked return value, store it in PSI element's user data.
|
static <T> T |
getCachedValue(PsiElement psi,
Key<CachedValue<T>> key,
CachedValueProvider<T> provider)
Create a cached value with the given provider and non-tracked return value, store it in PSI element's user data.
|
<T> T |
getCachedValue(UserDataHolder dataHolder,
CachedValueProvider<T> provider)
Create a cached value with the given provider and non-tracked return value, store it in the first argument's user data.
|
abstract <T> T |
getCachedValue(UserDataHolder dataHolder,
Key<CachedValue<T>> key,
CachedValueProvider<T> provider,
boolean trackValue)
Utility method storing created cached values in a
UserDataHolder . |
<T> Key<CachedValue<T>> |
getKeyForClass(java.lang.Class<?> providerClass) |
static CachedValuesManager |
getManager(Project project) |
<T,P> T |
getParameterizedCachedValue(UserDataHolder dataHolder,
Key<ParameterizedCachedValue<T,P>> key,
ParameterizedCachedValueProvider<T,P> provider,
boolean trackValue,
P parameter) |
protected abstract void |
trackKeyHolder(UserDataHolder dataHolder,
Key<?> key) |
public static CachedValuesManager getManager(Project project)
public abstract <T> CachedValue<T> createCachedValue(CachedValueProvider<T> provider, boolean trackValue)
CachedValueProvider.Result.getDependencyItems()
for
the details.provider
- computes values.trackValue
- if value tracking is required. T should be trackable in this case.public abstract <T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(ParameterizedCachedValueProvider<T,P> provider, boolean trackValue)
public <T> CachedValue<T> createCachedValue(CachedValueProvider<T> provider)
public <T,P> T getParameterizedCachedValue(UserDataHolder dataHolder, Key<ParameterizedCachedValue<T,P>> key, ParameterizedCachedValueProvider<T,P> provider, boolean trackValue, P parameter)
protected abstract void trackKeyHolder(UserDataHolder dataHolder, Key<?> key)
public abstract <T> T getCachedValue(UserDataHolder dataHolder, Key<CachedValue<T>> key, CachedValueProvider<T> provider, boolean trackValue)
UserDataHolder
.
The passed cached value provider may only depend on the passed user data holder and longer-living system state (e.g. project/application components/services),
see CachedValue
documentation for more details.dataHolder
- holder to store the cached value, e.g. a PsiElement.key
- key to store the cached value.provider
- provider creating the cached value.trackValue
- if value tracking is required (T should be trackable in that case). See createCachedValue(CachedValueProvider, boolean)
for more details.public <T> T getCachedValue(UserDataHolder dataHolder, CachedValueProvider<T> provider)
CachedValue
documentation for more details.public static <T> T getCachedValue(PsiElement psi, CachedValueProvider<T> provider)
CachedValue
documentation for more details.public static <T> T getCachedValue(PsiElement psi, Key<CachedValue<T>> key, CachedValueProvider<T> provider)
CachedValue
documentation for more details.public <T> Key<CachedValue<T>> getKeyForClass(java.lang.Class<?> providerClass)