Package org.djutils.data.serialization
Class FloatScalarSerializer<U extends Unit<U>,S extends FloatScalar<U,S>>
java.lang.Object
org.djutils.data.serialization.FloatScalarSerializer<U,S>
- Type Parameters:
U- the unit typeS- the scalar type
- All Implemented Interfaces:
TextSerializer<S>
public class FloatScalarSerializer<U extends Unit<U>,S extends FloatScalar<U,S>>
extends Object
implements TextSerializer<S>
FloatScalarSerializer (de)serializes DJUNITS float scalars. This class extends DoubleScalarSerializer. Since the target class
to deserialize is given to the deserialize method, the DoubleScalarSerializer.deserialize can also deserialize FloatScalar
values.
Copyright (c) 2020-2025 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
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
FloatScalarSerializer
public FloatScalarSerializer()
-
-
Method Details
-
serialize
Serialize an Scalar value to text in such a way that it can be deserialized with the corresponding deserializer.- Specified by:
serializein interfaceTextSerializer<U extends Unit<U>>- Parameters:
value- the scalar to serializeunitString- the unit used to convert the data to and store, so all valus in a column may have the same unit. The value may benullor blank- Returns:
- a string representation of the value that can later be deserialized
-
deserialize
Deserialize a String to the correct Scalar value. The method caches the valueOf(String) method for repeated use.- Specified by:
deserializein interfaceTextSerializer<U extends Unit<U>>- Parameters:
text- the text to deserializetype- class of the value type, may benullunit- unit with the value, may benullor blank- Returns:
- the reconstructed scalar
-