Package org.bukkit.metadata
Class LazyMetadataValue
java.lang.Object
org.bukkit.metadata.MetadataValueAdapter
org.bukkit.metadata.LazyMetadataValue
- All Implemented Interfaces:
- MetadataValue
- Direct Known Subclasses:
- FixedMetadataValue
The LazyMetadataValue class implements a type of metadata that is not
 computed until another plugin asks for it.
 
 By making metadata values lazy, no computation is done by the providing
 plugin until absolutely necessary (if ever). Additionally,
 LazyMetadataValue objects cache their values internally unless overridden
 by a LazyMetadataValue.CacheStrategy or invalidated at the individual or plugin
 level. Once invalidated, the LazyMetadataValue will recompute its value
 when asked.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumDescribes possible caching strategies for metadata.
- 
Field SummaryFields inherited from class org.bukkit.metadata.MetadataValueAdapterowningPlugin
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedLazyMetadataValue(Plugin owningPlugin) Protected special constructor used by FixedMetadataValue to bypass standard setup.LazyMetadataValue(Plugin owningPlugin, Callable<Object> lazyValue) Initialized a LazyMetadataValue object with the default CACHE_AFTER_FIRST_EVAL cache strategy.LazyMetadataValue(Plugin owningPlugin, LazyMetadataValue.CacheStrategy cacheStrategy, Callable<Object> lazyValue) Initializes a LazyMetadataValue object with a specific cache strategy.
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvalidates this metadata item, forcing it to recompute when next accessed.value()Fetches the value of this metadata item.Methods inherited from class org.bukkit.metadata.MetadataValueAdapterasBoolean, asByte, asDouble, asFloat, asInt, asLong, asShort, asString, getOwningPlugin
- 
Constructor Details- 
LazyMetadataValueInitialized a LazyMetadataValue object with the default CACHE_AFTER_FIRST_EVAL cache strategy.- Parameters:
- owningPlugin- the- Pluginthat created this metadata value.
- lazyValue- the lazy value assigned to this metadata value.
 
- 
LazyMetadataValuepublic LazyMetadataValue(@NotNull Plugin owningPlugin, @NotNull LazyMetadataValue.CacheStrategy cacheStrategy, @NotNull Callable<Object> lazyValue) Initializes a LazyMetadataValue object with a specific cache strategy.- Parameters:
- owningPlugin- the- Pluginthat created this metadata value.
- cacheStrategy- determines the rules for caching this metadata value.
- lazyValue- the lazy value assigned to this metadata value.
 
- 
LazyMetadataValueProtected special constructor used by FixedMetadataValue to bypass standard setup.- Parameters:
- owningPlugin- the owning plugin
 
 
- 
- 
Method Details- 
valueDescription copied from interface:MetadataValueFetches the value of this metadata item.- Returns:
- the metadata value.
 
- 
invalidatepublic void invalidate()Description copied from interface:MetadataValueInvalidates this metadata item, forcing it to recompute when next accessed.
 
-