Class DeserializedData<Data>
java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.deserialization.DeserializedData<Data>
- Type Parameters:
Data- The type of data this component consumes
- All Implemented Interfaces:
Destructible,Printable,ApplicationContext,ApplicationProvider,ComponentsContext,ComponentsProvider,EntityContext,EntityProvider,SceneContext,SceneProvider
A component that consumes deserialized data from a JSON file.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys this component and its file deserializer.getData()Returns the deserialized data.voidreadData(FileDeserializer<Data> deserializer) Reads the data from a file deserializer.voidCreates a file deserializer and reads data from it.voidCreates a file deserializer and reads data from it.Methods inherited from class dev.prozilla.pine.core.component.Component
equals, getApplication, getEntity, getName, getScene, hashCode, onEntityChange, setActive, setEntity, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.prozilla.pine.core.ApplicationProvider
getAudioDevice, getConfig, getInput, getLocalStorage, getLogger, getModManager, getRenderer, getTimer, getTracker, getWindowMethods inherited from interface dev.prozilla.pine.core.component.ComponentsProvider
getComponent, getComponentInParent, getComponentInParent, getComponents, getComponentsInChildrenMethods inherited from interface dev.prozilla.pine.core.entity.EntityContext
isDescendantOfMethods inherited from interface dev.prozilla.pine.core.entity.EntityProvider
getChild, getChildWithTag, getFirstChild, getLastChild, getParentWithTag, getTransform, isDescendantOfMethods inherited from interface dev.prozilla.pine.core.scene.SceneProvider
getCameraData, getWorld
-
Field Details
-
deserializer
-
-
Constructor Details
-
DeserializedData
public DeserializedData()
-
-
Method Details
-
readData
Creates a file deserializer and reads data from it.If the application is in developer mode, hot reloading will be enabled.
- Parameters:
directory- The directory of the filefileName- The name of the filedataType- The type of data to deserialize to
-
readData
Creates a file deserializer and reads data from it.- Parameters:
directory- The directory of the filefileName- The name of the filedataType- The type of data to deserialize tohotReload-trueenables hot reloading
-
readData
Reads the data from a file deserializer.This method can be used to initialize the component and create properties based on the data from the deserialized file.
- Parameters:
deserializer- The file deserializer
-
getData
Returns the deserialized data.- Returns:
- The deserialized data.
-
destroy
public void destroy()Destroys this component and its file deserializer.- Specified by:
destroyin interfaceDestructible- Overrides:
destroyin classComponent
-