JsonCodecAPI

abstract class JsonCodecAPI(makeVisitor: CompilationCache[JCodec] => SchemaVisitor[JCodec], hintMask: Option[HintMask], readerConfig: ReaderConfig, writerConfig: WriterConfig) extends CodecAPI
Companion:
object
trait CodecAPI
class Object
trait Matchable
class Any
class codecs

Type members

Types

type Cache = CompilationCache[JCodec]
type Codec[A] = JCodec[A]

Value members

Constructors

def this(schemaVisitorJCodec: SchemaVisitor[JCodec], hintMask: Option[HintMask], readerConfig: ReaderConfig, writerConfig: WriterConfig)

Concrete methods

def compileCodec[A](schema0: Schema[A], cache: Cache): JCodec[A]

Turns a Schema into this API's preferred representation.

Turns a Schema into this API's preferred representation.

Value parameters:
cache

a Cache that can be used to optimise the compilation of Schemas into Codecs.

schema

the value's schema

Returns:

the codec associated to the A value.

override def decodeFromByteArrayPartial[A](codec: JCodec[A], bytes: Array[Byte]): Either[PayloadError, BodyPartial[A]]

Decodes partial data from a byte array

Decodes partial data from a byte array

Value parameters:
bytes

an byte array

codec

the implementation-specific codec type

Returns:

either a PayloadError, or the partial data, which can be combined with partial data coming from the metadata.

Definition Classes
CodecAPI
override def decodeFromByteBufferPartial[A](codec: JCodec[A], bytes: ByteBuffer): Either[PayloadError, BodyPartial[A]]

Decodes partial data from a byte buffer, returning a function that is able to reconstruct the full data, provided a map resulting from the decoding of the metadata.

Decodes partial data from a byte buffer, returning a function that is able to reconstruct the full data, provided a map resulting from the decoding of the metadata.

Value parameters:
bytes

a bytue buffer

codec

the implementation-specific codec

Returns:

either a PayloadError, or the partial data, which can be combined with partial data coming from the metadata.

Definition Classes
CodecAPI
def mediaType[A](codec: JCodec[A]): Type
override def writeToArray[A](codec: JCodec[A], value: A): Array[Byte]

Writes data to a byte array. Field values bound to http metadata (path/query/headers) must be eluded.

Writes data to a byte array. Field values bound to http metadata (path/query/headers) must be eluded.

Value parameters:
codec

the implementation-specific codec

value

the value to encode

Definition Classes
CodecAPI

Inherited methods

final def compileCodec[A](schema: Schema[A]): Codec[A]

Turns a Schema into this API's preferred representation.

Turns a Schema into this API's preferred representation.

Value parameters:
schema

the value's schema

Returns:

the codec associated to the A value.

Inherited from:
CodecAPI
def decodeFromByteArray[A](codec: JCodec[A], bytes: Array[Byte]): Either[PayloadError, A]
Inherited from:
CodecAPI
def decodeFromByteBuffer[A](codec: JCodec[A], bytes: ByteBuffer): Either[PayloadError, A]
Inherited from:
CodecAPI