Interface CompositeAwareChild

All Superinterfaces:
ExtractableStorage, InsertableStorage, Storage, StorageView
All Known Implementing Classes:
CompositeStorageImpl, ExternalStorage

@API(status=STABLE, since="2.0.0-milestone.1.4") public interface CompositeAwareChild extends Storage
Implement this on storages that need to be aware of the fact that they are contained in a CompositeStorage. Typically, this is needed so that storages that dynamically modify their underlying storage sources, can propagate the changes to the parent composite list. Another reason to be aware of the parent composite is to be able to override the amount modified into the composite cache list.
  • Method Details

    • onAddedIntoComposite

      void onAddedIntoComposite(ParentComposite parentComposite)
      Called by a CompositeStorage when this CompositeAwareChild is added into the composite storage.
      Parameters:
      parentComposite - the composite storage that this CompositeAwareChild is contained in
    • onRemovedFromComposite

      void onRemovedFromComposite(ParentComposite parentComposite)
      Called by a CompositeStorage when this CompositeAwareChild is removed from the composite storage.
      Parameters:
      parentComposite - the composite storage that this CompositeAwareChild is/was contained in
    • compositeInsert

      CompositeAwareChild.Amount compositeInsert(ResourceKey resource, long amount, Action action, Actor actor)
      Inserts a resource into a storage.
      Parameters:
      resource - the resource, may not be null
      amount - the amount, must be larger than 0
      action - the mode of insertion
      actor - the source
      Returns:
      the amount inserted
    • compositeExtract

      CompositeAwareChild.Amount compositeExtract(ResourceKey resource, long amount, Action action, Actor actor)
      Extracts a resource from a storage.
      Parameters:
      resource - the resource, may not be null
      amount - the amount, must be larger than 0
      action - the mode of extraction
      actor - the source
      Returns:
      the amount extracted
    • contains

      default boolean contains(Storage storage)