org.djutils.serialization.serializers.BasicSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of djutils-serialization Show documentation
Show all versions of djutils-serialization Show documentation
DJUTILS serialization of data structures
package org.djutils.serialization.serializers;
/**
* Basics of the serializer
*
* Copyright (c) 2019-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
* @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;
}
@Override
public final byte fieldType()
{
return this.type;
}
@Override
public final String dataClassName()
{
return this.dataClassName;
}
@Override
public String toString()
{
return "BasicSerializer [type=" + this.type + ", dataClassName=" + this.dataClassName + "]";
}
}