Migrated to Voinea-Radu/Utils
Please consider checking out the update and maintained repository that also contains this utility
A simple lambda library used by many others proprietary libs and projects. Also implements a scheduler util class. Allows to pass functions or methods as arguments to other methods
The artifact can be found at the repository https://repo.lightdream.dev or https://jitpack.io (under com.github.L1ghtDream instead of dev.lightdream)
<repositories>
<repository>
<id>lightdream-repo</id>
<url>https://repo.lightdream.dev/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories><dependencies>
<dependency>
<groupId>dev.lightdream</groupId>
<artifactId>file-manager</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>com.github.L1ghtDream</groupId>
<artifactId>file-manager</artifactId>
<version>3.2.4</version>
</dependency>
</dependencies>repositories {
maven { url "https://repo.lightdream.dev/" }
maven { url "https://jitpack.io" }
}
dependencies {
implementation "dev.lightdream:file-manager:3.2.4"
implementation "com.github.L1ghtDream:file-manager:3.2.4"
}repositories {
maven("https://repo.lightdream.dev/")
maven("https://jitpack.io")
}
dependencies {
implementation("dev.lightdream:file-manager:3.2.4")
implementation("com.github.L1ghtDream:file-manager:3.2.4")
}If you want to use an older version that is not available in https://repo.lightdream.dev you can try using https://archive-repo.lightdream.dev
public class ExampleMain implements FileManagerMain {
public ExampleMain(GsonBuilder builder) {
FileManager fileManager = new FileManager(this);
// If you have any custom serializers you can use the FileManager#setGsonBuilder method
fileManager.setGsonBuilder(builder);
// If you want the FileManager instance to be accessible from a static context you can sue
fileManager.setStatic();
FileManager fileManagerFromStatic = FileManager.get();
}
@Override
public String getPath() {
return "config/Example";
}
}You can use any class that is serializable by JSON.
public class Foo {
private int property1;
private String property2;
}To save or load the class from or to disk you can use the FileManager#save and FileManager#load methods
public class ExampleClass {
public void save(FileManager fileManager) {
Foo bar = new Foo();
fileManager.save(bar);
}
public void load(FileManager fileManager) {
Foo bar = fileManager.load(Foo.class);
}
}