package serialization
- Alphabetic
- Public
- All
Type Members
-
trait
FallbackMapCodecs
extends RecursiveAutoCodecs
Contains readers for maps where there is no DBKeyCodec for key type.
Contains readers for maps where there is no DBKeyCodec for key type. In such case, we assume reading from a list of key-value pairs instead of JSON object.
-
trait
FieldInput
extends Input
An Input representing an object field.
-
trait
GenCodec
[T] extends AnyRef
Type class for types that can be serialized to
Output(format-agnostic "output stream") and deserialized fromInput(format-agnostic "input stream").Type class for types that can be serialized to
Output(format-agnostic "output stream") and deserialized fromInput(format-agnostic "input stream").GenCodecis supposed to capture generic structure of serialized objects, without being bound to particular format like JSON. The actual format is determined by implementation ofInputandOutput.There are convenient macros for automatic derivation of
GenCodecinstances (materializeandmaterializeRecursively). However,GenCodecinstances still need to be explicitly declared and won't be derived "automagically". If you want fully automatic derivation, useGenCodec.Auto.- Annotations
- @implicitNotFound( "No GenCodec found for ${T}" )
-
trait
GenKeyCodec
[T] extends AnyRef
Typeclass which expresses ability to convert between MongoDB JSON object keys and values of some type.
Typeclass which expresses ability to convert between MongoDB JSON object keys and values of some type. Every type which has a natural, unambiguous string representation should have a DBKeyCodec.
- Annotations
- @implicitNotFound( ... )
-
abstract
class
HasGenCodec
[T] extends AnyRef
Convenience abstract class for companion objects of types that have a GenCodec.
Convenience abstract class for companion objects of types that have a GenCodec. Unfortunately, due to compiler and language limitations this only works for non-generic case classes without default constructor arguments.
-
trait
Input
extends Any
Represents an abstract source from which a value may be deserialized (read).
Represents an abstract source from which a value may be deserialized (read). Each of the
readmethods tries to read a value of specified type and may throw an exception (usually com.avsystem.commons.serialization.GenCodec.ReadFailure) when reading is not successful.An Input value should be assumed to be stateful. If any of the
readXmethods have already been called, the Input instance can no longer be used and MUST be discarded.In order to ignore the value kept in this Input,
skip()MUST be called.In summary: every Input MUST be fully exhausted by either calling one of the
readmethods which returns successful value or by callingskip(). Also, ListInput and ObjectInput instances returned from this Input must also be fully exhausted on their own. -
sealed
trait
InputType
extends AnyRef
Represents the type of value inside and Input that can be read from it.
Represents the type of value inside and Input that can be read from it.
It is possible to distinguish only between four types (null, simple value, object and list) even though any of these types may have different representations. For example, InputType.Simple is returned for more than one actual value types (numbers, booleans, strings, timestamps, binary, etc.).
It's not possible to distinguish between them based only on InputType because not every Input implementation is able to do that. For example, JSON must represent 64-bit integers as strings and therefore it can't distinguish between strings and numbers in general.
-
trait
ListInput
extends SequentialInput
Represents an abstract source of sequence of values that can be deserialized.
Represents an abstract source of sequence of values that can be deserialized. ListInput instance is stateful and MUST be read strictly sequentially. This means, you MUST fully exhaust an Input instance returned by
nextElement()before callingnextElement()again. For this reason, ListInput is not anIteratordespite having similar interface (Iteratorwould easily allow e.g. conversion toList[Input]which would be illegal).ListInput MUST always be fully exhausted. In order to ignore any remaining elements, skipRemaining() may be used.
-
trait
ListOutput
extends SequentialOutput
Represents an abstract sink for serialization of sequences of values.
Represents an abstract sink for serialization of sequences of values. Any ListOutput instance must be assumed to be stateful and used in strictly sequential manner. After all elements have been written,
finish()must be called to explicitly mark that the list is complete. - final case class MacroCodec [T](codec: GenCodec[T]) extends AnyVal with Product with Serializable
-
trait
ObjectInput
extends SequentialInput
Represents an abstract source of key-value mappings that can be deserialized.
Represents an abstract source of key-value mappings that can be deserialized. ObjectInput instance is stateful and MUST be read strictly sequentially. This means, you MUST fully exhaust any Input instance returned by
nextField()before callingnextField()again. For this reason, ObjectInput is not anIteratordespite having similar interface (Iteratorwould easily allow e.g. conversion toList[(String, Input)]which would be illegal).ObjectInput MUST always be fully exhausted. In order to ignore any remaining key-value mappings,
skipRemaining()may be used.NOTE: The order of keys returned by subsequent invocations of
nextField()may be arbitrary and in particular may not match the order in which keys were written to corresponding ObjectOutput. -
trait
ObjectOutput
extends SequentialOutput
Represents an abstract sink for serialization of string-to-value mappings.
Represents an abstract sink for serialization of string-to-value mappings. Any ObjectOutput instance must be assumed to be stateful and used in strictly sequential manner. After all key-value pairs have been written,
finish()must be called to explicitly mark that the object is complete. -
trait
Output
extends Any
Represents an abstract sink to which a value may be serialized (written).
Represents an abstract sink to which a value may be serialized (written). An Output instance should be assumed to be stateful. After calling any of the
writemethods, it MUST NOT be reused. This means that Output instance can be used only to write a single value. However, if the value to write is complex, one can usewriteList/writeSetorwriteObject/writeMap. - trait RecursiveAutoCodecs extends AnyRef
- trait SequentialInput extends Any
-
trait
SequentialOutput
extends Any
Base trait for outputs which allow writing of multiple values in sequence, i.e.
Base trait for outputs which allow writing of multiple values in sequence, i.e. ListOutput and ObjectOutput.
- class SimpleValueFieldInput extends SimpleValueInput with FieldInput
- class SimpleValueInput extends Input
- class SimpleValueOutput extends Output
- class StreamFieldInput extends StreamInput with FieldInput
- class StreamInput extends Input
- class StreamOutput extends Output
-
trait
TupleGenCodecs
extends AnyRef
Author: ghik Created: 19/11/15.
Value Members
- object GenCodec extends FallbackMapCodecs with TupleGenCodecs
- object GenKeyCodec
- object GenTupleDBCodecs
- object InputType
- object MacroCodec extends Serializable