Package de.eimmer.metadaten
Class FaulerMetadatenWert
java.lang.Object
de.eimmer.metadaten.MetadatenWertAdapter
de.eimmer.metadaten.FaulerMetadatenWert
- All Implemented Interfaces:
MetadatenWert
- Direct Known Subclasses:
UnveraenderlicherMetadatenWert
The FaulerMetadatenWert class implements a type of meta that is not
computed until another zusatzmodul asks for it.
By making meta values lazy, no computation is done by the providing
zusatzmodul until absolutely necessary (if ever). Additionally,
FaulerMetadatenWert objects cache their values internally unless overridden
by a FaulerMetadatenWert.CacheStrategy
or invalidated at the individual or zusatzmodul
level. Once invalidated, the FaulerMetadatenWert will recompute its value
when asked.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Describes possible caching strategies for meta. -
Field Summary
Fields inherited from class de.eimmer.metadaten.MetadatenWertAdapter
owningPlugin
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FaulerMetadatenWert
(Zusatzmodul owningZusatzmodul) Protected special constructor used by UnveraenderlicherMetadatenWert to bypass standard setup.FaulerMetadatenWert
(Zusatzmodul owningZusatzmodul, FaulerMetadatenWert.CacheStrategy cacheStrategy, Callable<Object> lazyValue) Initializes a FaulerMetadatenWert object with a specific cache strategy.FaulerMetadatenWert
(Zusatzmodul owningZusatzmodul, Callable<Object> lazyValue) Initialized a FaulerMetadatenWert object with the default CACHE_AFTER_FIRST_EVAL cache strategy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invalidates this meta item, forcing it to recompute when next accessed.value()
Fetches the value of this meta item.Methods inherited from class de.eimmer.metadaten.MetadatenWertAdapter
asBoolean, asByte, asDouble, asFloat, asInt, asLong, asShort, asString, getOwningPlugin
-
Constructor Details
-
FaulerMetadatenWert
public FaulerMetadatenWert(@NotNull Zusatzmodul owningZusatzmodul, @NotNull Callable<Object> lazyValue) Initialized a FaulerMetadatenWert object with the default CACHE_AFTER_FIRST_EVAL cache strategy.- Parameters:
owningZusatzmodul
- theZusatzmodul
that created this meta value.lazyValue
- the lazy value assigned to this meta value.
-
FaulerMetadatenWert
public FaulerMetadatenWert(@NotNull Zusatzmodul owningZusatzmodul, @NotNull FaulerMetadatenWert.CacheStrategy cacheStrategy, @NotNull Callable<Object> lazyValue) Initializes a FaulerMetadatenWert object with a specific cache strategy.- Parameters:
owningZusatzmodul
- theZusatzmodul
that created this meta value.cacheStrategy
- determines the rules for caching this meta value.lazyValue
- the lazy value assigned to this meta value.
-
FaulerMetadatenWert
Protected special constructor used by UnveraenderlicherMetadatenWert to bypass standard setup.- Parameters:
owningZusatzmodul
- the owning zusatzmodul
-
-
Method Details
-
value
Description copied from interface:MetadatenWert
Fetches the value of this meta item.- Returns:
- the meta value.
-
invalidate
public void invalidate()Description copied from interface:MetadatenWert
Invalidates this meta item, forcing it to recompute when next accessed.
-