package pro.gravit.launcher.config; import java.lang.reflect.Type; import java.nio.file.Path; public abstract class SimpleConfig implements JsonConfigurableInterface { private transient final Class type; protected transient final Path configPath; protected SimpleConfig(Class type, Path configPath) { this.type = type; this.configPath = configPath; } @SuppressWarnings("unchecked") @Override public T getConfig() { return (T) this; } @Override public T getDefaultConfig() { try { return type.newInstance(); } catch (InstantiationException | IllegalAccessException e) { return null; } } @Override public Path getPath() { return configPath; } @Override public Type getType() { return type; } }