public abstract class AbstractPropertiesHandler<T extends AbstractPropertiesHandler<T>> extends Object
Modifier and Type | Class and Description |
---|---|
class |
AbstractPropertiesHandler.PropertyAccessor<V> |
Modifier and Type | Field and Description |
---|---|
private static Logger |
LOGGER |
private Properties |
properties |
Constructor and Description |
---|
AbstractPropertiesHandler(Properties properties) |
Modifier and Type | Method and Description |
---|---|
protected <V> AbstractPropertiesHandler.PropertyAccessor<V> |
accessor(String key,
Function<String,V> parser,
Function<V,String> stringifier,
V fallback) |
protected <V> AbstractPropertiesHandler.PropertyAccessor<V> |
accessor(String key,
Function<String,V> parser,
V fallback) |
protected AbstractPropertiesHandler.PropertyAccessor<Boolean> |
booleanAccessor(String key,
boolean fallback) |
protected static <V> Function<String,V> |
combineParser(IntFunction<V> intParser,
Function<String,V> fallbackParser) |
protected Properties |
copyProperties() |
protected abstract T |
create(DynamicRegistryManager dynamicRegistryManager,
Properties properties)
Creates another property handler with the same type as this one from the
passed new map of properties.
|
protected <V> V |
get(String key,
Function<String,V> parser,
Function<V,String> stringifier,
V fallback) |
protected <V> V |
get(String key,
Function<String,V> parser,
UnaryOperator<V> parsedTransformer,
Function<V,String> stringifier,
V fallback) |
protected <V> V |
get(String key,
Function<String,V> parser,
V fallback) |
protected <V> V |
getDeprecated(String key,
Function<String,V> stringifier) |
protected Boolean |
getDeprecatedBoolean(String key) |
protected String |
getDeprecatedString(String key) |
protected int |
getInt(String key,
int fallback) |
protected String |
getString(String key,
String fallback) |
private String |
getStringValue(String key) |
protected AbstractPropertiesHandler.PropertyAccessor<Integer> |
intAccessor(String key,
int fallback) |
static Properties |
loadProperties(Path path)
Loads a map of properties from the
path . |
protected boolean |
parseBoolean(String key,
boolean fallback) |
protected long |
parseLong(String key,
long fallback) |
void |
saveProperties(Path path)
Saves the properties of this handler to the
path . |
protected int |
transformedParseInt(String key,
UnaryOperator<Integer> transformer,
int fallback) |
private static <V extends Number> |
wrapNumberParser(Function<String,V> parser) |
private static final Logger LOGGER
private final Properties properties
public AbstractPropertiesHandler(Properties properties)
public static Properties loadProperties(Path path)
path
.public void saveProperties(Path path)
path
.private static <V extends Number> Function<String,V> wrapNumberParser(Function<String,V> parser)
protected static <V> Function<String,V> combineParser(IntFunction<V> intParser, Function<String,V> fallbackParser)
protected <V> V get(String key, Function<String,V> parser, Function<V,String> stringifier, V fallback)
protected <V> AbstractPropertiesHandler.PropertyAccessor<V> accessor(String key, Function<String,V> parser, Function<V,String> stringifier, V fallback)
protected <V> V get(String key, Function<String,V> parser, UnaryOperator<V> parsedTransformer, Function<V,String> stringifier, V fallback)
protected <V> AbstractPropertiesHandler.PropertyAccessor<V> accessor(String key, Function<String,V> parser, V fallback)
protected int getInt(String key, int fallback)
protected AbstractPropertiesHandler.PropertyAccessor<Integer> intAccessor(String key, int fallback)
protected int transformedParseInt(String key, UnaryOperator<Integer> transformer, int fallback)
protected long parseLong(String key, long fallback)
protected boolean parseBoolean(String key, boolean fallback)
protected AbstractPropertiesHandler.PropertyAccessor<Boolean> booleanAccessor(String key, boolean fallback)
protected Properties copyProperties()
protected abstract T create(DynamicRegistryManager dynamicRegistryManager, Properties properties)