2019-06-02 05:03:08 +03:00
|
|
|
package pro.gravit.launcher.config;
|
2019-04-03 13:09:53 +03:00
|
|
|
|
|
|
|
import java.lang.reflect.Type;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
|
2019-06-03 10:58:10 +03:00
|
|
|
import pro.gravit.launcher.LauncherAPI;
|
|
|
|
|
2019-09-20 00:55:57 +03:00
|
|
|
public abstract class JsonConfigurable<T> implements JsonConfigurableInterface<T> {
|
|
|
|
private transient final Type type;
|
|
|
|
protected transient final Path configPath;
|
2019-05-15 14:11:22 +03:00
|
|
|
|
2019-04-13 18:31:22 +03:00
|
|
|
@LauncherAPI
|
2019-04-03 13:09:53 +03:00
|
|
|
public JsonConfigurable(Type type, Path configPath) {
|
|
|
|
this.type = type;
|
|
|
|
this.configPath = configPath;
|
|
|
|
}
|
2019-05-15 14:11:22 +03:00
|
|
|
|
2019-09-20 00:55:57 +03:00
|
|
|
@Override
|
|
|
|
public Path getPath() {
|
|
|
|
return configPath;
|
2019-04-03 13:09:53 +03:00
|
|
|
}
|
2019-05-15 14:11:22 +03:00
|
|
|
|
2019-09-20 00:55:57 +03:00
|
|
|
@Override
|
|
|
|
public Type getType() {
|
|
|
|
return type;
|
2019-04-13 18:31:22 +03:00
|
|
|
}
|
2019-05-15 14:11:22 +03:00
|
|
|
|
2019-04-13 18:31:22 +03:00
|
|
|
@LauncherAPI
|
2019-04-03 13:09:53 +03:00
|
|
|
public abstract T getConfig();
|
2019-05-15 14:11:22 +03:00
|
|
|
|
2019-04-13 18:31:22 +03:00
|
|
|
@LauncherAPI
|
2019-04-03 13:09:53 +03:00
|
|
|
public abstract T getDefaultConfig();
|
2019-05-15 14:11:22 +03:00
|
|
|
|
2019-04-13 18:31:22 +03:00
|
|
|
@LauncherAPI
|
2019-04-03 13:09:53 +03:00
|
|
|
public abstract void setConfig(T config);
|
|
|
|
}
|