Interface DataStoreFactory<C>
-
- All Known Subinterfaces:
DataStoreFactory.Convertable<C>
public interface DataStoreFactory<C>
A factory to create a data store from its identifier and configuration options.Data store factory implementations are discovered using the JDK
ServiceLoaderinterface.- Since:
- 2.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceDataStoreFactory.Convertable<C>A data store type that is used for migration from other permissions systems.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Map<String,DataStoreFactory<?>>all()ProtoDataStore<C>create(String identifier, org.spongepowered.configurate.ConfigurationNode config)Create a new proto data-store.DataStoredefrost(DataStoreContext ctx, ProtoDataStore<C> properties)Performs any loading necessary to resolve a full data store from its definition.static @Nullable DataStoreFactory<?>forType(String type)Get a factory for the type identifier.net.kyori.adventure.text.ComponentfriendlyName()A user-visible name for this data store type.Stringname()The name for the data store type, usable for lookup.voidserialize(org.spongepowered.configurate.ConfigurationNode node, ProtoDataStore<C> protoStore)Write the configuration defined by the proto-store to a node.
-
-
-
Method Detail
-
forType
static @Nullable DataStoreFactory<?> forType(String type)
Get a factory for the type identifier.The type identifier is not case-sensitive.
- Parameters:
type- requested type- Returns:
- a factory, or null if none is available.
-
all
static Map<String,DataStoreFactory<?>> all()
-
friendlyName
net.kyori.adventure.text.Component friendlyName()
A user-visible name for this data store type.- Returns:
- the data store type name
-
name
String name()
The name for the data store type, usable for lookup.- Returns:
- data store type name
- Since:
- 2.0.0
-
create
ProtoDataStore<C> create(String identifier, org.spongepowered.configurate.ConfigurationNode config) throws PermissionsLoadingException
Create a new proto data-store.The returned instance will have its configuration validated, but will not attempt to load any data until it is defrosted.
- Parameters:
identifier- the identifier for this specific data store instance.config- options used to configure the data store- Returns:
- a new data store instance, not yet loaded
- Throws:
PermissionsLoadingException- if any of the configuration options are invalid- Since:
- 2.0.0
-
defrost
DataStore defrost(DataStoreContext ctx, ProtoDataStore<C> properties) throws PermissionsLoadingException
Performs any loading necessary to resolve a full data store from its definition.- Parameters:
properties- the data store definition- Returns:
- a full data store
- Throws:
PermissionsLoadingException- if the data store has data in an invalid format- Since:
- 2.0.0
-
serialize
void serialize(org.spongepowered.configurate.ConfigurationNode node, ProtoDataStore<C> protoStore) throws org.spongepowered.configurate.serialize.SerializationException
Write the configuration defined by the proto-store to a node.- Parameters:
node- the destination for the configurationprotoStore- the data store- Throws:
org.spongepowered.configurate.serialize.SerializationException- if unable to write data fully- Since:
- 2.0.0
-
-