Class HotFileDeserializer<Data>
java.lang.Object
dev.prozilla.pine.common.property.mutable.SimpleMutableObjectProperty<Data>
dev.prozilla.pine.common.property.observable.SimpleObservableObjectProperty<Data>
dev.prozilla.pine.common.property.deserialized.FileDeserializer<Data>
dev.prozilla.pine.common.property.deserialized.HotFileDeserializer<Data>
- All Implemented Interfaces:
Destructible,MutableObjectProperty<Data>,MutableProperty<Data>,ObservableObjectProperty<Data>,ObservableProperty<Data>,SimpleObservableProperty<Data>,Property<Data>,Functor<Data>
Deserializes data from a JSON file and hot reloads it whenever changes are detected.
-
Field Summary
Fields inherited from class dev.prozilla.pine.common.property.deserialized.FileDeserializer
ALWAYS_CREATE_DATA_DEFAULT, alwaysCreateData, pathFields inherited from class dev.prozilla.pine.common.property.observable.SimpleObservableObjectProperty
loggerFields inherited from interface dev.prozilla.pine.common.property.observable.ObservableProperty
OBSERVER_ERROR -
Constructor Summary
ConstructorsConstructorDescriptionHotFileDeserializer(DirectoryWatcher directoryWatcher, String path, Class<Data> dataType) HotFileDeserializer(DirectoryWatcher directoryWatcher, String path, Class<Data> dataType, boolean alwaysCreateData) -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStreamCreates an input stream from the file.voiddestroy()Removes all observers.protected voidDeserializes the file and updates the property of this value whenever the file changes.Methods inherited from class dev.prozilla.pine.common.property.deserialized.FileDeserializer
addDeserializers, createBooleanProperty, createBooleanProperty, createFallbackData, createFloatProperty, createFloatProperty, createIntProperty, createIntProperty, createProperty, createProperty, createStringProperty, createStringProperty, deserialize, resetFeatureStates, setAlwaysCreateData, setFailOnInvalidSubtype, setFailOnNullForPrimitives, setFailOnUnknowProperties, setFeatureStateMethods inherited from class dev.prozilla.pine.common.property.observable.SimpleObservableObjectProperty
addObserver, getLogger, onValueChange, removeObserver, setLoggerMethods inherited from class dev.prozilla.pine.common.property.mutable.SimpleMutableObjectProperty
getValue, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.prozilla.pine.common.property.mutable.MutableObjectProperty
setNull, stealMethods inherited from interface dev.prozilla.pine.common.property.mutable.MutableProperty
modifyValue, setValue, swapValue, viewPropertyMethods inherited from interface dev.prozilla.pine.common.property.observable.ObservableProperty
readMethods inherited from interface dev.prozilla.pine.common.property.Property
getValue, getValueOr, hasValue, hasValueProperty, isNotNull, isNotNullProperty, isNull, map, replaceNull, requireValue, snapshot, toStringProperty
-
Constructor Details
-
HotFileDeserializer
-
HotFileDeserializer
public HotFileDeserializer(DirectoryWatcher directoryWatcher, String path, Class<Data> dataType, boolean alwaysCreateData)
-
-
Method Details
-
onFileChange
Deserializes the file and updates the property of this value whenever the file changes.- Parameters:
event- The file change event
-
createInputStream
Description copied from class:FileDeserializerCreates an input stream from the file.- Overrides:
createInputStreamin classFileDeserializer<Data>- Returns:
- The input stream.
-
destroy
public void destroy()Description copied from class:SimpleObservableObjectPropertyRemoves all observers.- Specified by:
destroyin interfaceDestructible- Overrides:
destroyin classSimpleObservableObjectProperty<Data>
-