package serializer
- Alphabetic
- Public
- All
Type Members
- final class BooleanPrimitive extends Primitive[Boolean]
- final class Buffer extends AnyRef
- final class ByteArrayPrimitive extends Primitive[Array[Byte]]
- final class CanBuildFromDeserializer[Elem, Col] extends CollectionDeserializerBase[Col]
- final class CharPrimitive extends Primitive[Char]
- abstract class CollectionDeserializerBase[Col] extends Deserializer[Col]
-
trait
CollectionInput extends NestedInput
For reading Collections
-
trait
CommonTypeImplicits extends AnyRef
These are implicit serializers/deserializers for common types that do not require the use of a macro to generate.
These are implicit serializers/deserializers for common types that do not require the use of a macro to generate.
Common types that DO require a macro are embedded into the makeSerializer/makeDeserializer via MacroHelpers.tryCommonType() since we can't call macros from here without creating a separate compilation package.
- trait Deserializer[T] extends RawDeserializer[T] with NestedDeserializer[T]
- trait DeserializerLowPrioImplicits extends AnyRef
- final class DeserializerProxy[T] extends Deserializer[T]
- final class DoublePrimitive extends Primitive[Double]
-
final
class
FMByteArrayOutputStream extends OutputStream with Appendable
A ByteArrayOutputStream implementation optimized for writing binary serialized data (e.g.
A ByteArrayOutputStream implementation optimized for writing binary serialized data (e.g. Protocol Buffers).
Tries to avoid excessive memory allocations and array resizing by using an Array of Byte Arrays to represent the data. Supports directly appending Byte Arrays (zero-copy), writing length prefixed data, optimized writing of ASCII and UTF-8 strings without going through a java.io.Writer.
-
final
class
Field extends Annotation with StaticAnnotation
- Annotations
- @getter() @setter() @param()
-
trait
FieldInput extends NestedInput
FIELD Input
FIELD Input
This the extra methods for reading FIELD input along with the NestedInput methods
-
trait
FieldOutput extends AnyRef
FIELD Output
FIELD Output
See the documentation for Output
- trait FieldSerializer[T] extends AnyRef
- final class FixedIntPrimitive extends Primitive[Int]
- final class FixedLongPrimitive extends Primitive[Long]
- final class FloatPrimitive extends Primitive[Float]
- final class GrowableDeserializer[Elem, Col <: Growable[Elem]] extends CollectionDeserializerBase[Col]
- final class IPSerializer extends SimpleSerializer[IP]
-
final
class
ImmutableArrayDeserializer[Elem, Col >: ImmutableArray[Elem]] extends CollectionDeserializerBase[Col]
A specialized implementation for deserializing ImmutableArrays.
- final class ImmutableByteArrayPrimitive extends Primitive[ImmutableArray[Byte]]
- final class ImmutableIntArrayDeserializer extends CollectionDeserializerBase[ImmutableArray[Int]]
- final class ImmutableLongArrayDeserializer extends CollectionDeserializerBase[ImmutableArray[Long]]
-
trait
Input extends FieldInput with CollectionInput with NestedInput with RawInput
Generic Input trait to be implemented by Serialization Implementations
Generic Input trait to be implemented by Serialization Implementations
See the docs for Output for the distinction between RAW, NESTED, and FIELD Input/Output. The only difference for Input is that there aren't readNestedXXX() methods. Instead the way fields for objects are read is:
- readFieldNumber(...) to get the name/number of the field
- readNestedXXX() to get the value of the field (based on looking up the proper type given the name/number)
- final class IntPrimitive extends Primitive[Int]
- final class JavaCollectionDeserializer[Elem, Col <: Collection[Elem]] extends CollectionDeserializerBase[Col]
-
final
class
JavaIterableSerializer[T, Col <: Iterable[T]] extends Serializer[Col] with FieldSerializer[Col]
A Serializer/FieldSerializer for a Java Iterable
- final class LinkedByteArrayOutputStream extends OutputStream
- final class LongPrimitive extends Primitive[Long]
- abstract class MacroHelpers extends AnyRef
- final class MappedSimpleSerializer[A, B] extends SimpleSerializer[B]
- trait Mapper[A, B] extends AnyRef
- trait NestedDeserializer[T] extends AnyRef
-
trait
NestedInput extends AnyRef
NESTED Input
NESTED Input
See documentation for Input/Output traits
-
trait
NestedOutput extends AnyRef
NESTED Output
NESTED Output
See the documentation for Output
- trait NestedSerializer[T] extends AnyRef
-
trait
ObjectDeserializer[T] extends Deserializer[T]
A combined Object Serializer/Deserializer that Serializes/Deserializes Objects from/to the same type
-
trait
ObjectSerializer[T] extends Serializer[T]
A combined Object Serializer/Deserializer that Serializes/Deserializes Objects from/to the same type
-
final
case class
OptionDeserializer[A]()(implicit deser: Deserializer[A]) extends Deserializer[Option[A]] with Product with Serializable
For deserializing Option types.
For deserializing Option types. Note: this does NOT allow Some(null)
- final case class OptionSerializer[A]()(implicit ser: Serializer[A]) extends Serializer[Option[A]] with Product with Serializable
-
trait
Output extends FieldOutput with NestedOutput with RawOutput
Generic Output trait to be implemented by Serialization Implementations
Generic Output trait to be implemented by Serialization Implementations
There are 3 classes of outputs:
- RAW
- NESTED
- FIELD
RAW Raw output is what you get if you serialize something by itself. Depending on the serialization implementation it will probably have an implicit length determined by the length of an Array[Byte], String, InputStream, etc. The starting point for serializing something it usually invoking one of the writeRawXXX(...) methods. The writeRawXXX(...) methods should be implemented by all serialization implementations.
NESTED Nested output is what we use when something is serialized as part of something else and may or may not be different than RAW output depending on the serialization implementation. For example, when serializing a collection each element would be serialized using the writeNestedXXX(...) methods. The nested format might have additional length information compared to the RAW format since there is no implicit length. For example, in protocol buffers a string/object/collection is prefixed with its length. Most serialization implementations can probably write optional length information followed by calling the corresponding writeRawXXX(...) method.
Another way to think about nested output is what we should be able to deserialize a NESTED value that is in the middle of an array of bytes (or a string or whatever). This means we need to know when to stop reading the value. For something like Protocol Buffers we will be prepending the length for string/object/repeated field or have a marker bit for varints to know when to stop. For something like JSON we will hit a double-quote (for strings) for a comma or closing brace (for all other types).
FIELD Field output is used when writing fields of an object. In addition to the value we are serializing it contains the name/number of the field in the object. Most implementations will probably write out the field name/number information followed by a call to the corresponding writeNestedXXX(...) method. Some implementations, such as Protocol Buffers, writes out the type of the field as part of the name/number which is why there isn't just a writeFieldName(...) which the framework would call automatically followed by the appropriate writeNestedXXX(...).
NOTE - Reading field output (via Input) is broken into a readFieldNumber() call to get the name/number of the field followed by calls to readNestedXXX().
Things are broken out this way to mainly support more complex formats (like Protocol Buffers). For something like a JSON implementation the RAW and NESTED formats will probably be the same. The way in which we write out JSON fields as part of an object will also be the same no matter what the type is unlike something like Protocol Buffers which needs to encode the type of field as part of the name/number of the field.
- sealed trait Primitive[T] extends SimpleSerializer[T]
-
trait
PrimitiveImplicits extends AnyRef
These are the default implicits for primitives
- trait RawDeserializer[T] extends AnyRef
-
trait
RawInput extends AnyRef
RAW Input
RAW Input
See documentation for Input/Output traits
-
trait
RawOutput extends AnyRef
RAW Output
RAW Output
See the documentation for Output
- trait RawSerializer[T] extends AnyRef
-
final
class
RenameField extends Annotation with StaticAnnotation
- Annotations
- @getter() @setter() @param()
-
trait
SerializableCompanion[A] extends AnyRef
Usage Pattern:
Usage Pattern:
import fm.serializer.{SerializableCompanion, SerializableInstance, SimpleSerializer}
object Foo extends SerializableCompanion[Foo] { protected val serializer: SimpleSerializer[Foo] = makeSerializer[Foo] }
final case class Foo(bar: String) extends SerializableInstance[Foo] { protected def companion: SerializableCompanion[Foo] = Foo }
-
trait
SerializableInstance[A] extends AnyRef
Usage Pattern:
Usage Pattern:
import fm.serializer.{SerializableCompanion, SerializableInstance, SimpleSerializer}
object Foo extends SerializableCompanion[Foo] { protected val serializer: SimpleSerializer[Foo] = makeSerializer[Foo] }
final case class Foo(bar: String) extends SerializableInstance[Foo] { protected def companion: SerializableCompanion[Foo] = Foo }
- trait Serializer[T] extends RawSerializer[T] with NestedSerializer[T] with FieldSerializer[T]
- trait SerializerLowPrioImplicits extends AnyRef
- final class SerializerProxy[T] extends Serializer[T]
- final class SignedIntPrimitive extends Primitive[Int]
- final class SignedLongPrimitive extends Primitive[Long]
- final case class SimpleObjectSerializer[T]()(implicit ser: ObjectSerializer[T], deser: ObjectDeserializer[T]) extends ObjectSerializer[T] with ObjectDeserializer[T] with SimpleSerializer[T] with Product with Serializable
-
trait
SimpleSerializer[A] extends Serializer[A] with Deserializer[A]
A combined Serializer/Deserializer that works on the same type
- final class StringMapCanBuildFromDeserializer[V, Col] extends Deserializer[Col]
- final class StringMapGrowableDeserializer[V, Col <: Growable[(String, V)]] extends Deserializer[Col]
-
final
class
StringMapSerializer[V, Col <: TraversableOnce[(String, V)]] extends Serializer[Col]
A Serializer for a Map[String,V] (or rather TraversableOnce[(String,V)]) that allows us to output a JSON Object for a Map[String,V] instead of an Array[(String,V)].
A Serializer for a Map[String,V] (or rather TraversableOnce[(String,V)]) that allows us to output a JSON Object for a Map[String,V] instead of an Array[(String,V)]. If the underlying Output doesn't support this style (e.g. Protobuf) then the TraversableOnceSerializer is used instead.
- final class StringPrimitive extends Primitive[String]
-
final
class
StringUtils extends AnyRef
Some non-public helpers from java.lang.{Integer,Long}
-
final
class
TraversableOnceSerializer[T, Col <: TraversableOnce[T]] extends Serializer[Col]
A Serializer for a TraversableOnce
- final class UnsignedIntPrimitive extends Primitive[Int]
- final class UnsignedLongPrimitive extends Primitive[Long]
-
final
class
VectorDeserializer[Elem, Col >: Vector[Elem]] extends CollectionDeserializerBase[Col]
A specialized implementation for deserializing Vectors.
Value Members
-
object
BooleanOptionDeserializer extends Deserializer[Option[Boolean]]
A Specialzed Option[Boolean] deserializer that uses static true/false values to prevent allocating memory.
- object Buffer
- object CanBuildFromDeserializer
- object Deserializer extends DeserializerLowPrioImplicits with PrimitiveImplicits with CommonTypeImplicits with BsonImplicits
- object FMByteArrayOutputStream
-
object
IntOptionDeserializer extends Deserializer[Option[Int]]
Note: This caches Option[Int] instances (much like java.lang.Integer caches Integer instances).
Note: This caches Option[Int] instances (much like java.lang.Integer caches Integer instances). By default the cache attempts to use the same range that the java.lang.Integer cache uses but the method used to determine the range is somewhat dependant on how OpenJDK handles caching. You can override the default upper limit using the "fm.serializer.IntOptionDeserializer.Cache.high" system property if the default behavior of trying to detect the java.lang.Integer cache range doesn't work for you.
- object LinkedByteArrayOutputStream
- object Macros
- object ObjectDeserializer
- object ObjectSerializer
- object Primitive extends PrimitiveImplicits
- object PrimitiveImplicits extends PrimitiveImplicits
- object Serializer extends SerializerLowPrioImplicits with PrimitiveImplicits with CommonTypeImplicits with BsonImplicits
- object SimpleObjectSerializer extends Serializable
- object StringMapCanBuildFromDeserializer