Interface DeserializeInput
- All Superinterfaces:
ConfigurationDefinition.ReadOptions,DeserializeContext,ErrorContext.Source,UpdateListener
DataTree.
The object itself is provided by object().
Implementation
Instances of this type are implemented by the library and supplied to SerializeDeserialize implementations.
Equality is not defined, and no thread safety is provided.
This type should not be implemented by library consumers. New methods may be added in the future, and this interface
should be considered sealed. If library consumers decide to implement this interface, they might expose themselves
to NoSuchMethodErrors if they pass their implementation to more up-to-date liaisons.
-
Method Summary
Modifier and TypeMethodDescription@NonNull DataEntryentry()The entry of the object being deserialized.@NonNull DeserializeInputDeprecated.@NonNull DeserializeInputMakes a child at the given subkey and prepares it for deserialization.default @NonNull Objectobject()The actual object which is being deserialized.@NonNull LoadResult<@NonNull DataList> Requires the object to be a list of data entries.@NonNull LoadResult<@NonNull DataTree> Requires the object to be a data tree, i.e.@NonNull LoadResult<@NonNull String> Requires the object to be a stringMethods inherited from interface space.arim.dazzleconf.ConfigurationDefinition.ReadOptions
maximumErrorCollectMethods inherited from interface space.arim.dazzleconf.engine.DeserializeContext
keyMapper, keyPath, notifyUpdateMethods inherited from interface space.arim.dazzleconf.ErrorContext.Source
buildError, getLocale, throwError, throwError
-
Method Details
-
entry
@NonNull DataEntry entry()The entry of the object being deserialized.- Returns:
- the entry
-
object
The actual object which is being deserialized.This is merely
entry().getValue(), meaning it is guaranteed to be one of the canonical values given byDataEntry: primitives, String, DataList, or DataTree.- Returns:
- the object
-
requireString
@NonNull LoadResult<@NonNull String> requireString()Requires the object to be a string- Returns:
- the object as a string, or an error result if the type is mismatched
-
requireDataTree
@NonNull LoadResult<@NonNull DataTree> requireDataTree()Requires the object to be a data tree, i.e. a map of key/value pairs.Callers may want to pair use of this method with the key mapper if they wish to read and write using string keys on the
DataTree.- Returns:
- the object as a data tree, or an error result if the type is mismatched
-
requireDataList
@NonNull LoadResult<@NonNull DataList> requireDataList()Requires the object to be a list of data entries.- Returns:
- the object as a data list, or an error result if the type is mismatched
-
makeChild
Deprecated.This method will be removed in 2.0 in favor ofmakeChild(DataEntry, Object). That method requires the caller to supply the child value's location, so to replicate this method's behavior, you would need to number your calls to this method and pass"$" + idxas the location.Makes a child and prepares it for deserialization.The child value is supposed to be taken "from" this object. For example, an element in a list would be a child object of the list. The child value is checked to conform to
DataEntry.validateValue(Object).- Parameters:
value- the child value to wrap- Returns:
- deserializable input
- Throws:
IllegalArgumentException- ifDataEntry.validateValue(value)returns false
-
makeChild
Makes a child at the given subkey and prepares it for deserialization.The child entry is supposed to be taken "from" this object. For example, an element in a list would be a child entry of the list.
The
keyPartargument provides a user recognizable string identifying where the child value is located. For example, list items can provide the index of the element.- Parameters:
entry- the child entry to wraplocIdentiier- an identifier for the child entry's location, based ontoString()- Returns:
- deserializable input
-
makeChild(DataEntry, Object).