Class SelectiveStoreLayout

java.lang.Object
discord4j.common.store.impl.SelectiveStoreLayout
All Implemented Interfaces:
StoreLayout

@Experimental public class SelectiveStoreLayout extends Object implements StoreLayout
StoreLayout that enables caches based on the passed in StoreFlag values.
  • Method Details

    • create

      public static <U extends DataAccessor & GatewayDataUpdater> StoreLayout create(EnumSet<StoreFlag> enabledStoreFlags, U delegate)
      Create a new store layout that can partially enable entity stores depending on passed enabledStoreFlags. Refer to StoreFlag values to understand each affected store operation.
      Parameters:
      enabledStoreFlags - a set of values indicating how to partially enable the delegate capabilities
      delegate - a delegate for store queries and updates
    • create

      public static StoreLayout create(EnumSet<StoreFlag> enabledFlags, DataAccessor dataAccessor, GatewayDataUpdater gatewayDataUpdater)
      Create a new store layout that can partially enable entity stores depending on passed enabledStoreFlags. Refer to StoreFlag values to understand affected store operations.
      Parameters:
      enabledFlags - a set of values indicating how to partially enable the delegate capabilities
      dataAccessor - a delegate for store queries
      gatewayDataUpdater - a delegate for store updates
    • getDataAccessor

      public DataAccessor getDataAccessor()
      Description copied from interface: StoreLayout
      Returns a DataAccessor that defines action handlers for reading data from the store.
      Specified by:
      getDataAccessor in interface StoreLayout
      Returns:
      a DataAccessor
    • getGatewayDataUpdater

      public GatewayDataUpdater getGatewayDataUpdater()
      Description copied from interface: StoreLayout
      Returns a GatewayDataUpdater that defines action handlers for updates received from the Discord gateway.
      Specified by:
      getGatewayDataUpdater in interface StoreLayout
      Returns:
      a GatewayDataUpdater
    • getEnabledFlags

      public EnumSet<StoreFlag> getEnabledFlags()
      Description copied from interface: StoreLayout
      Return a set of StoreFlag values to selectively enable store actions. By default, it returns all values, meaning this layout will enable all available store actions.
      Specified by:
      getEnabledFlags in interface StoreLayout
      Returns:
      a set of flags to partially enable store actions