Package discord4j.store.api.noop
Class NoOpStoreService
- java.lang.Object
-
- discord4j.store.api.noop.NoOpStoreService
-
- All Implemented Interfaces:
StoreService
public class NoOpStoreService extends Object implements StoreService
Service which provides stores that do nothing. This is automatically used if no valid save services are found.- See Also:
NoOpStore
,NoOpLongObjStore
-
-
Constructor Summary
Constructors Constructor Description NoOpStoreService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>
dispose()
This is a lifecycle method called to signal that a store should dispose of any resources due to an abrupt close (hard reconnect or disconnect).boolean
hasGenericStores()
This is used to check if this service can provide generic stores.boolean
hasLongObjStores()
This is used to check if this service can provide long-object stores.reactor.core.publisher.Mono<Void>
init(StoreContext context)
This is a lifecycle method called to signal that a store should allocate any necessary resources.int
order()
Returns an arbitrary order for this service.<K extends Comparable<K>,V extends Serializable>
Store<K,V>provideGenericStore(Class<K> keyClass, Class<V> valueClass)
This is called to provide a new store instance for the provided configuration.<V extends Serializable>
LongObjStore<V>provideLongObjStore(Class<V> valueClass)
This is called to provide a new store instance with a long key and object values.
-
-
-
Method Detail
-
order
public int order()
Description copied from interface:StoreService
Returns an arbitrary order for this service. This is used for automated service discovery in the case that multiple services are present. Conventions: 0 = neutral priority,Integer.MAX_VALUE
= lowest priority,Integer.MIN_VALUE
= highest priority.- Specified by:
order
in interfaceStoreService
- Returns:
- The priority of this service, 0 by default.
-
hasGenericStores
public boolean hasGenericStores()
Description copied from interface:StoreService
This is used to check if this service can provide generic stores.- Specified by:
hasGenericStores
in interfaceStoreService
- Returns:
- True if possible, else false.
- See Also:
Store
-
provideGenericStore
public <K extends Comparable<K>,V extends Serializable> Store<K,V> provideGenericStore(Class<K> keyClass, Class<V> valueClass)
Description copied from interface:StoreService
This is called to provide a new store instance for the provided configuration.- Specified by:
provideGenericStore
in interfaceStoreService
- Type Parameters:
K
- The key type which provides a 1:1 mapping to the value type. This type is also expected to beComparable
in order to allow for range operations.V
- The value type, these follow JavaBean conventions.- Parameters:
keyClass
- The class of the keys.valueClass
- The class of the values.- Returns:
- The instance of the store.
-
hasLongObjStores
public boolean hasLongObjStores()
Description copied from interface:StoreService
This is used to check if this service can provide long-object stores.- Specified by:
hasLongObjStores
in interfaceStoreService
- Returns:
- True if possible, else false.
- See Also:
LongObjStore
-
provideLongObjStore
public <V extends Serializable> LongObjStore<V> provideLongObjStore(Class<V> valueClass)
Description copied from interface:StoreService
This is called to provide a new store instance with a long key and object values.- Specified by:
provideLongObjStore
in interfaceStoreService
- Type Parameters:
V
- The value type, these follow JavaBean conventions.- Parameters:
valueClass
- The class of the values.- Returns:
- The instance of the store.
-
init
public reactor.core.publisher.Mono<Void> init(StoreContext context)
Description copied from interface:StoreService
This is a lifecycle method called to signal that a store should allocate any necessary resources.- Specified by:
init
in interfaceStoreService
- Parameters:
context
- Some context about the environment which this service is being utilized in.- Returns:
- A mono, whose completion signals that resources have been allocated successfully.
-
dispose
public reactor.core.publisher.Mono<Void> dispose()
Description copied from interface:StoreService
This is a lifecycle method called to signal that a store should dispose of any resources due to an abrupt close (hard reconnect or disconnect).- Specified by:
dispose
in interfaceStoreService
- Returns:
- A mono, whose completion signals that resources have been released successfully.
-
-