Package org.djutils.data.serialization
Interface SpecificTextSerializer<T>
-
- Type Parameters:
T
- the value type
- All Superinterfaces:
TextSerializer<T>
- All Known Implementing Classes:
BooleanSerializer
,ByteSerializer
,CharacterSerializer
,DoubleSerializer
,FloatSerializer
,IntegerSerializer
,LongSerializer
,ShortSerializer
,StringSerializer
public interface SpecificTextSerializer<T> extends TextSerializer<T>
StrictTextSerializer adds one method to the textSerializer class where it it is not necessary to specify the type for the deserialize method, since it is a specific class.Copyright (c) 2020-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default T
deserialize(String text)
Deserialize a value from text that has been created with the corresponding serializer, where the value does not have a unit, and the class is known and fixed (and not checked).default String
serialize(T value)
Serialize a value to text in such a way that it can be deserialized with the corresponding deserializer.-
Methods inherited from interface org.djutils.data.serialization.TextSerializer
deserialize, serialize
-
-
-
-
Method Detail
-
serialize
default String serialize(T value)
Serialize a value to text in such a way that it can be deserialized with the corresponding deserializer. Note thatnull
values for value are allowed. Anull
values stands for an empty column value in a CVS-file, a missing tag in an XML-file, etc. This version of the serialize method ignores the unit.- Parameters:
value
- T; the value to serialize, may benull
- Returns:
- String; a string representation of the value that can later be deserialized, or
null
to denote a missing value
-
deserialize
default T deserialize(String text)
Deserialize a value from text that has been created with the corresponding serializer, where the value does not have a unit, and the class is known and fixed (and not checked). Note thatnull
values for text are allowed. Anull
values stands for an empty column value in a CVS-file, a missing tag in an XML-file, etc. In this way, we can explicitly show values that were not specified in the file.- Parameters:
text
- String; the string to deserialize, may benull
- Returns:
- T; an instance of the object created with the corresponding serializer, may be
null
when a value was not specified in the source from which the deserializer was called
-
-