package org.djutils.serialization.serializers; /** * Basics of the serializer *

* Copyright (c) 2019-2021 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See DJUTILS License. *

* @version $Revision$, $LastChangedDate$, by $Author$,
* @author Alexander Verbraeck * @author Peter Knoppers * @param class */ public abstract class BasicSerializer implements Serializer { /** The field type that usually prefixes the serialized data. */ private final byte type; /** String returned by the dataClassName method. */ private final String dataClassName; /** * Construct the BasicSerializer. * @param type byte; the field type (returned by the fieldType method) * @param dataClassName String; returned by the dataClassName method */ public BasicSerializer(final byte type, final String dataClassName) { this.type = type; this.dataClassName = dataClassName; } /** {@inheritDoc} */ @Override public final byte fieldType() { return this.type; } /** {@inheritDoc} */ @Override public final String dataClassName() { return this.dataClassName; } /** {@inheritDoc} */ @Override public String toString() { return "BasicSerializer [type=" + this.type + ", dataClassName=" + this.dataClassName + "]"; } }