Interface DataView
- All Known Subinterfaces:
DataContainer
DataViews always exist within a DataContainer and can be used
for serialization.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe safety mode of the container. -
Method Summary
Modifier and TypeMethodDescriptionGets the parent container of this DataView.booleanReturns whether thisDataViewcontains the given path.booleancopy()Copies thisDataViewand all of it's contents into a newDataContainer.copy(DataView.SafetyMode safety) Copies thisDataViewand all of it's contents into a newDataContainerwith the given safety mode.default DataViewcreateView(String key) Creates a newDataViewat the desired key.createView(DataQuery path) Creates a newDataViewat the desired path.createView(DataQuery path, Map<?, ?> map) Creates a newDataViewwith the given data at the desired path.Gets the current path of thisDataViewfrom its rootDataContainer.Gets an object from the desired path.getBoolean(DataQuery path) Gets theBooleanby path, if available.getBooleanList(DataQuery path) Gets theByteby path, if available.getByteList(DataQuery path) getCharacterList(DataQuery path) getDataKey(DataQuery path) Gets thekeyby path, if available.getDataKeyList(DataQuery path) Gets theDoubleby path, if available.getDoubleList(DataQuery path) Gets theFloatby path, if available.getFloatList(DataQuery path) Gets theIntegerby path, if available.getIntegerList(DataQuery path) Gets theListof something by path, if available.Gets theLongby path, if available.getLongList(DataQuery path) Gets the underlyingMapby path, if available.getMapList(DataQuery path) <T> Optional<T> Gets theObjectobject by path, if available.getObjectList(DataQuery path, Class<T> objectClass) Gets theListofDataSerializableby path, if available.default <T> Optional<T> getRegistryValue(DataQuery path, RegistryType<T> registryType) Gets thevalueby path, if available, from the global registry.<T> Optional<T> getRegistryValue(DataQuery path, RegistryType<T> registryType, RegistryHolder holder) Gets thevalueby path, if available.getRegistryValueList(DataQuery path, RegistryType<T> registryType) getRegistryValueList(DataQuery path, RegistryType<T> registryType, RegistryHolder holder) default Optional<ResourceKey> getResourceKey(DataQuery path) Gets thekeyby path, if available.default Optional<List<ResourceKey>> getResourceKeyList(DataQuery path) <T extends DataSerializable>
Optional<T> getSerializable(DataQuery path, Class<T> clazz) Gets theDataSerializableobject by path, if available.<T extends DataSerializable>
Optional<List<T>> getSerializableList(DataQuery path, Class<T> clazz) Gets theListofDataSerializableby path, if available.Gets theShortby path, if available.getShortList(DataQuery path) Gets theStringby path, if available.getStringList(DataQuery path) Gets theDataViewby key, if available.Gets theDataViewby path, if available.getViewList(DataQuery path) booleanisEmpty()Gets if this view contains no data.keys(boolean deep) Gets a collection containing all keys in thisDataView.name()Gets the name of this individualDataViewin the path.parent()Gets the parentDataViewof this view.Removes the data associated to the given path relative to thisDataView's path.Gets theDataView.SafetyModeof this data view.default DataViewSets the given boolean value to thisDataView's key.default DataViewSets the given byte value to thisDataView's key.default DataViewSets the given double value to thisDataView's key.default DataViewSets the given float value to thisDataView's key.default DataViewSets the given int value to thisDataView's key.default DataViewSets the given long value to thisDataView's key.default DataViewSets the given short value to thisDataView's key.default DataViewSets the given Object value to thisDataView's key.default DataViewSets the given String value to thisDataView's key.default DataViewSets the given boolean value according to the given path relative to thisDataView's path.default DataViewSets the given byte value according to the given path relative to thisDataView's path.default DataViewSets the given double value according to the given path relative to thisDataView's path.default DataViewSets the given float value according to the given path relative to thisDataView's path.default DataViewSets the given int value according to the given path relative to thisDataView's path.default DataViewSets the given long value according to the given path relative to thisDataView's path.default DataViewSets the given short value according to the given path relative to thisDataView's path.Sets the given Object value according to the given path relative to thisDataView's path.default DataViewSets the given String value according to the given path relative to thisDataView's path.Gets a Stream containing all root keys for thisDataView.Gets a Stream containing all root keys and their values for thisDataView.values(boolean deep) Gets a Map containing all keys and their values for thisDataView.
-
Method Details
-
container
DataContainer container()Gets the parent container of this DataView.Every DataView will always have a
DataContainer.For any
DataContainer, this will return itself.- Returns:
- The parent container
-
currentPath
DataQuery currentPath()Gets the current path of thisDataViewfrom its rootDataContainer.For any
DataContaineritself, this will return an empty string as it is the root of the path.The full path will always include this
DataViews name at the end of the path.- Returns:
- The path of this view originating from the root
-
name
String name()Gets the name of this individualDataViewin the path.This will always be the final substring of the full path from
currentPath().- Returns:
- The name of this DataView
-
parent
Gets the parentDataViewof this view. The parent directly contains this view according to thecurrentPath().For any
DataContainer, this will return an absent parent.- Returns:
- The parent data view containing this view
-
keys
Gets a collection containing all keys in thisDataView.If deep is set to true, then this will contain all the keys within any child
DataViews (and their children, etc). These will be in a valid path notation for you to use.If deep is set to false, then this will contain only the keys of any direct children, and not their own children.
- Parameters:
deep- Whether or not to get all children keys- Returns:
- A set of current keys in this container
-
streamRootKeys
-
values
Gets a Map containing all keys and their values for thisDataView.If deep is set to true, then this will contain all the keys and values within any child
DataViews (and their children, etc). These keys will be in a valid path notation for you to use.If deep is set to false, then this will contain only the keys and values of any direct children, and not their own children.
- Parameters:
deep- Whether or not to get a deep list of all children or not- Returns:
- Map of keys and values of this container
-
streamRootValues
-
contains
-
contains
-
get
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
remove
-
createView
-
createView
-
createView
-
getView
-
getView
-
getMap
-
getBoolean
-
getShort
-
getByte
-
getInt
-
getLong
-
getFloat
-
getDouble
-
getString
-
getResourceKey
Gets thekeyby path, if available.- Parameters:
path- The path of the value to get- Returns:
- The key, if available
-
getResourceKeyList
-
getList
-
getStringList
-
getCharacterList
-
getBooleanList
-
getByteList
-
getShortList
-
getIntegerList
-
getLongList
-
getFloatList
-
getDoubleList
-
getMapList
-
getViewList
-
getSerializable
Gets theDataSerializableobject by path, if available.If a
DataSerializableexists, but is not the proper class type, or there is no data at the path given, an absent is returned.It is important that the
DataManagerprovided is the same one that has registered many of theDataBuilders to ensure theDataSerializablerequested can be returned.- Type Parameters:
T- The type ofDataSerializableobject- Parameters:
path- The path of the value to getclazz- The class of theDataSerializable- Returns:
- The deserialized object, if available
-
getSerializableList
Gets theListofDataSerializableby path, if available.If a
Listexists, but the contents of the list are not consideredDataSerializableor are not of the proper type ofDataSerializable, an absent is returned.It is important that the
DataManagerprovided is the same one that has registered many of theDataBuilders to ensure theDataSerializablerequested can be returned.- Type Parameters:
T- The type ofDataSerializableobject- Parameters:
path- The path of the list value to getclazz- The class of theDataSerializable- Returns:
- The deserialized objects in a list, if available
-
getObject
Gets theObjectobject by path, if available.If a
Objectexists, but is not the proper class type, or there is no data at the path given, an absent is returned.It is important that the
DataManagerprovided is the same one that has registered many of theDataTranslators to ensure theDataSerializablerequested can be returned. -
getObjectList
Gets theListofDataSerializableby path, if available.If a
Listexists, but the contents of the list are not consideredDataTranslator"able" or are not of the proper type ofDataTranslator, an absent is returned.It is important that the
DataManagerprovided is the same one that has registered many of theDataTranslators to ensure theObjectrequested can be returned. -
getRegistryValue
Gets thevalueby path, if available, from the global registry.- Type Parameters:
T- The type of dummy- Parameters:
path- The path of the value to getregistryType- The class of the dummy type- Returns:
- The dummy type, if available
-
getRegistryValueList
- Type Parameters:
T- The type of dummy type- Parameters:
path- The path of the list value to getregistryType- The type of registry to search- Returns:
- The list of dummy types, if available
-
getRegistryValue
<T> Optional<T> getRegistryValue(DataQuery path, RegistryType<T> registryType, RegistryHolder holder) Gets thevalueby path, if available.- Type Parameters:
T- The type of dummy- Parameters:
path- The path of the value to getregistryType- The class of the dummy typeholder- The holder to get the registry from- Returns:
- The dummy type, if available
-
getRegistryValueList
<T> Optional<List<T>> getRegistryValueList(DataQuery path, RegistryType<T> registryType, RegistryHolder holder) - Type Parameters:
T- The type of dummy type- Parameters:
path- The path of the list value to getregistryType- The type of registry to searchholder- the holder to get the registry from- Returns:
- The list of dummy types, if available
-
getDataKey
-
getDataKeyList
-
copy
DataContainer copy()Copies thisDataViewand all of it's contents into a newDataContainer.Note that the copy will not have the same path as this
DataViewsince it will be constructed with the top level path being itself.- Returns:
- The newly constructed data view
-
copy
Copies thisDataViewand all of it's contents into a newDataContainerwith the given safety mode.Note that the copy will not have the same path as this
DataViewsince it will be constructed with the top level path being itself.- Parameters:
safety- The safety mode of the copy- Returns:
- The newly constructed data view
-
isEmpty
boolean isEmpty()Gets if this view contains no data.- Returns:
- True if no data
-
safetyMode
DataView.SafetyMode safetyMode()Gets theDataView.SafetyModeof this data view.- Returns:
- The safety mode
-