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-2024 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

    Modifier and Type
    Method
    Description
    default T
    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 Details

    • 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 that null values for value are allowed. A null 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 be null
      Returns:
      String; a string representation of the value that can later be deserialized, or nullto 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 that null values for text are allowed. A null 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 be null
      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