程序包 org.bukkit.metadata

# 类 LazyMetadataValue

java.lang.Object
org.bukkit.metadata.MetadataValueAdapter
org.bukkit.metadata.LazyMetadataValue

所有已实现的接口:
  `MetadataValue`

直接已知子类:
  `FixedMetadataValue`

public class LazyMetadataValue extends MetadataValueAdapter
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.

- ## 嵌套类概要

  嵌套类
  修饰符和类型
  类
  说明
  `static enum`
  `LazyMetadataValue.CacheStrategy`
  Describes possible caching strategies for metadata.

- ## 字段概要

  ### 从类继承的字段 org.bukkit.metadata.MetadataValueAdapter

  `owningPlugin`

- ## 构造器概要

  构造器
  限定符
  构造器
  说明
  `protected`
  `LazyMetadataValue(@NotNull Plugin owningPlugin)`
  Protected special constructor used by FixedMetadataValue to bypass standard setup.
  ``
  `LazyMetadataValue(@NotNull Plugin owningPlugin, @NotNull Callable<Object> lazyValue)`
  Initialized a LazyMetadataValue object with the default CACHE_AFTER_FIRST_EVAL cache strategy.
  ``
  `LazyMetadataValue(@NotNull Plugin owningPlugin, @NotNull LazyMetadataValue.CacheStrategy cacheStrategy, @NotNull Callable<Object> lazyValue)`
  Initializes a LazyMetadataValue object with a specific cache strategy.

- ## 方法概要

  修饰符和类型
  方法
  说明
  `void`
  `invalidate()`
  Invalidates this metadata item, forcing it to recompute when next accessed.
  `@Nullable Object`
  `value()`
  Fetches the value of this metadata item.

  ### 从类继承的方法 org.bukkit.metadata.MetadataValueAdapter

  `asBoolean, asByte, asDouble, asFloat, asInt, asLong, asShort, asString, getOwningPlugin`

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 构造器详细资料

  - ### LazyMetadataValue

    public LazyMetadataValue(@NotNull @NotNull Plugin owningPlugin, @NotNull @NotNull Callable<Object> lazyValue)
    Initialized a LazyMetadataValue object with the default CACHE_AFTER_FIRST_EVAL cache strategy.
    参数:
      `owningPlugin` - the `Plugin` that created this metadata value.
      `lazyValue` - the lazy value assigned to this metadata value.

  - ### LazyMetadataValue

    public LazyMetadataValue(@NotNull @NotNull Plugin owningPlugin, @NotNull @NotNull LazyMetadataValue.CacheStrategy cacheStrategy, @NotNull @NotNull Callable<Object> lazyValue)
    Initializes a LazyMetadataValue object with a specific cache strategy.
    参数:
      `owningPlugin` - the `Plugin` that created this metadata value.
      `cacheStrategy` - determines the rules for caching this metadata value.
      `lazyValue` - the lazy value assigned to this metadata value.

  - ### LazyMetadataValue

    protected LazyMetadataValue(@NotNull @NotNull Plugin owningPlugin)
    Protected special constructor used by FixedMetadataValue to bypass standard setup.
    参数:
      `owningPlugin` - the owning plugin

- ## 方法详细资料

  - ### value

    @Nullable public @Nullable Object value()
    从接口复制的说明: `MetadataValue`
    Fetches the value of this metadata item.
    返回:
      the metadata value.

  - ### invalidate

    public void invalidate()
    从接口复制的说明: `MetadataValue`
    Invalidates this metadata item, forcing it to recompute when next accessed.