Added more config methods

This commit is contained in:
Auxilor
2021-07-18 23:37:41 +01:00
committed by Auxilor
parent fb900a18ad
commit eadbb489a7
4 changed files with 113 additions and 1 deletions

View File

@@ -162,6 +162,17 @@ public interface Config extends Cloneable {
@NotNull
String getString(@NotNull String path);
/**
* Get a string from config.
*
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
* @return The found value, or an empty string if not found.
*/
@NotNull
String getString(@NotNull String path,
boolean format);
/**
* Get a string from config.
*
@@ -171,6 +182,17 @@ public interface Config extends Cloneable {
@Nullable
String getStringOrNull(@NotNull String path);
/**
* Get a string from config.
*
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
* @return The found value, or null if not found.
*/
@Nullable
String getStringOrNull(@NotNull String path,
boolean format);
/**
* Get a list of strings from config.
* <p>
@@ -202,6 +224,17 @@ public interface Config extends Cloneable {
@Nullable
List<String> getStringsOrNull(@NotNull String path);
/**
* Get a list of strings from config.
*
* @param path The key to fetch the value from.
* @param format If the strings should be formatted.
* @return The found value, or null if not found.
*/
@Nullable
List<String> getStringsOrNull(@NotNull String path,
boolean format);
/**
* Get a decimal from config.
*

View File

@@ -117,11 +117,23 @@ public abstract class ConfigWrapper<T extends Config> implements Config {
return handle.getString(path);
}
@Override
public @NotNull String getString(@NotNull final String path,
final boolean format) {
return handle.getString(path, format);
}
@Override
public @Nullable String getStringOrNull(@NotNull final String path) {
return handle.getStringOrNull(path);
}
@Override
public @Nullable String getStringOrNull(@NotNull final String path,
final boolean format) {
return handle.getStringOrNull(path, format);
}
@Override
public @NotNull List<String> getStrings(@NotNull final String path) {
return handle.getStrings(path);
@@ -138,6 +150,12 @@ public abstract class ConfigWrapper<T extends Config> implements Config {
return handle.getStringsOrNull(path);
}
@Override
public @Nullable List<String> getStringsOrNull(@NotNull final String path,
final boolean format) {
return handle.getStringsOrNull(path, format);
}
@Override
public double getDouble(@NotNull final String path) {
return handle.getDouble(path);