A powerful configuration module that encapsulates SimplixStorage with additional features:
- ✨ Serialization annotations
- 🏭 Factory mode support
- 🔒 Built-in thread safety
- 🚀 Enhanced performance
dependencies {
// Required modules
compileOnly(files("libs/annotation-1.0-SNAPSHOT.jar"))
compileOnly(files("libs/configuration-1.0-SNAPSHOT.jar"))
}
Here's a basic example of how to use the configuration module:
public class Example extends Plugin {
@Override
public void onPluginEnable() {
// Create a SimplixBuilder instance
SimplixBuilder simplixBuilder =
SimplixBuilderFactory.createSimplixBuilder("example", "D:/");
// Choose your preferred format (JSON/TOML/YAML)
Yaml yaml = simplixBuilder.createYaml();
// Thread-safe operations
yaml.set("example", "test");
// For more operations, visit:
// https://github.com/Simplix-Softworks/SimplixStorage/wiki
}
}
Create a custom serializer by implementing SimplixSerializable
and using the @SimplixSerializerSerializableAutoRegister
annotation:
@SimplixSerializerSerializableAutoRegister
public class PlantSerializable implements SimplixSerializable<Plant> {
@Override
public Plant deserialize(@NonNull Object object) throws ClassCastException {
// Implement deserialization logic
return plant;
}
@Override
public Object serialize(@NonNull Plant plant) throws ClassCastException {
// Implement serialization logic
return serializedData;
}
@Override
public Class<Plant> getClazz() {
return Plant.class;
}
}
Easily serialize and deserialize objects using the SimplixSerializer
:
// Serialization
String serialized = SimplixSerializer.serialize(plant).toString();
// Deserialization
Plant plant = SimplixSerializer.deserialize(plantString, Plant.class);
- Thread Safety: Built-in thread safety mechanisms for reliable concurrent operations
- Multiple Formats: Support for JSON, YAML, and TOML configurations 1
- Auto-Registration: Automatic serializer registration using annotations
- Factory Pattern: Simplified object creation through factory methods
- Type Safety: Strong typing support for configuration values
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
The module is optimized for performance with:
- Efficient thread synchronization
- Minimal overhead for serialization operations
- Smart caching mechanisms