public class PropertiesManager extends Object
| Constructor and Description |
|---|
PropertiesManager(PropertiesHandle propertiesHandle)
Creates a new instance that uses the given
PropertiesHandle |
| Modifier and Type | Method and Description |
|---|---|
void |
detachSaveOnClose(Window window)
Detaches the listener that was attached to the given window when
it was passed to
saveOnClose(Window) |
void |
registerColor(String name,
Supplier<? extends Color> supplier,
Consumer<? super Color> consumer)
Register the given supplier and consumer under the given name
|
void |
registerDouble(String name,
DoubleSupplier supplier,
DoubleConsumer consumer)
Register the given supplier and consumer under the given name
|
void |
registerInteger(String name,
IntSupplier supplier,
IntConsumer consumer)
Register the given supplier and consumer under the given name
|
void |
registerPath(String name,
Supplier<? extends Path> supplier,
Consumer<? super Path> consumer)
Register the given supplier and consumer under the given name
|
void |
registerPoint(String name,
Supplier<? extends Point> supplier,
Consumer<? super Point> consumer)
Register the given supplier and consumer under the given name
|
void |
registerRectangle(String name,
Supplier<? extends Rectangle> supplier,
Consumer<? super Rectangle> consumer)
Register the given supplier and consumer under the given name
|
void |
registerString(String name,
Supplier<? extends String> supplier,
Consumer<? super String> consumer)
Register the given supplier and consumer under the given name
|
void |
restore()
Restore the state, by passing all values from the properties file
to the registered consumers.
|
void |
save()
Save the current state, by obtaining all values from the registered
suppliers, and writing them into the properties file
|
void |
saveOnClose(Window window)
Attach a listener to the given window that will save the properties
when the window is closed
|
public PropertiesManager(PropertiesHandle propertiesHandle)
PropertiesHandlepropertiesHandle - The PropertiesHandlepublic void registerString(String name, Supplier<? extends String> supplier, Consumer<? super String> consumer)
name - The namesupplier - The supplierconsumer - The consumerpublic void registerInteger(String name, IntSupplier supplier, IntConsumer consumer)
name - The namesupplier - The supplierconsumer - The consumerpublic void registerDouble(String name, DoubleSupplier supplier, DoubleConsumer consumer)
name - The namesupplier - The supplierconsumer - The consumerpublic void registerPath(String name, Supplier<? extends Path> supplier, Consumer<? super Path> consumer)
name - The namesupplier - The supplierconsumer - The consumerpublic void registerPoint(String name, Supplier<? extends Point> supplier, Consumer<? super Point> consumer)
name - The namesupplier - The supplierconsumer - The consumerpublic void registerRectangle(String name, Supplier<? extends Rectangle> supplier, Consumer<? super Rectangle> consumer)
name - The namesupplier - The supplierconsumer - The consumerpublic void registerColor(String name, Supplier<? extends Color> supplier, Consumer<? super Color> consumer)
name - The namesupplier - The supplierconsumer - The consumerpublic void save()
public void restore()
public void saveOnClose(Window window)
window - The windowpublic void detachSaveOnClose(Window window)
saveOnClose(Window)window - The windowCopyright © 2022. All rights reserved.