接口 MetadataStore<T>


public interface MetadataStore<T>
  • 方法详细资料

    • setMetadata

      void setMetadata(@NotNull T subject, @NotNull @NotNull String metadataKey, @NotNull @NotNull MetadataValue newMetadataValue)
      Adds a metadata value to an object.
      参数:
      subject - The object receiving the metadata.
      metadataKey - A unique key to identify this metadata.
      newMetadataValue - The metadata value to apply.
      抛出:
      IllegalArgumentException - If value is null, or the owning plugin is null
    • getMetadata

      @NotNull @NotNull List<MetadataValue> getMetadata(@NotNull T subject, @NotNull @NotNull String metadataKey)
      Returns all metadata values attached to an object. If multiple plugins have attached metadata, each will value will be included.
      参数:
      subject - the object being interrogated.
      metadataKey - the unique metadata key being sought.
      返回:
      A list of values, one for each plugin that has set the requested value.
    • hasMetadata

      boolean hasMetadata(@NotNull T subject, @NotNull @NotNull String metadataKey)
      Tests to see if a metadata attribute has been set on an object.
      参数:
      subject - the object upon which the has-metadata test is performed.
      metadataKey - the unique metadata key being queried.
      返回:
      the existence of the metadataKey within subject.
    • removeMetadata

      void removeMetadata(@NotNull T subject, @NotNull @NotNull String metadataKey, @NotNull @NotNull Plugin owningPlugin)
      Removes a metadata item owned by a plugin from a subject.
      参数:
      subject - the object to remove the metadata from.
      metadataKey - the unique metadata key identifying the metadata to remove.
      owningPlugin - the plugin attempting to remove a metadata item.
      抛出:
      IllegalArgumentException - If plugin is null
    • invalidateAll

      void invalidateAll(@NotNull @NotNull Plugin owningPlugin)
      Invalidates all metadata in the metadata store that originates from the given plugin. Doing this will force each invalidated metadata item to be recalculated the next time it is accessed.
      参数:
      owningPlugin - the plugin requesting the invalidation.
      抛出:
      IllegalArgumentException - If plugin is null