sealed abstract class Codec[A] extends AnyRef
Provides a schema, along with encoding and decoding functions for a given type.
- Annotations
- @implicitNotFound()
- Source
- Codec.scala
- Alphabetic
- By Inheritance
- Codec
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type AvroType
The Java type that this codec will encode to.
The Java type that this codec will encode to. The resulting value will in turn be converted to a binary or JSON-based Avro format by the underlying Avro SDK.
This type is of interest mainly because it determines what Avro type the data will ultimately be encoded to; therefore, we express it using type aliases named according to the Avro type they represent.
Deprecated Type Members
Abstract Value Members
- abstract def decode(value: Any, schema: Schema): Either[AvroError, A]
Attempts to decode the specified value using the provided schema.
- abstract def encode(a: A): Either[AvroError, AvroType]
Attempts to encode the specified value using the provided schema.
- abstract def schema: Either[AvroError, Schema]
The schema or an error if the schema could not be generated.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def imap[B](f: (A) => B)(g: (B) => A): Aux[AvroType, B]
Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types
A
andB
. - def imapError[B](f: (A) => Either[AvroError, B])(g: (B) => A): Aux[AvroType, B]
Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types
A
andB
.Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types
A
andB
.Similar to Codec#imap, except the mapping from
A
toB
might be unsuccessful. - def imapErrors[B](f: (A) => Either[AvroError, B])(g: (B) => Either[AvroError, A]): Aux[AvroType, B]
- final def imapTry[B](f: (A) => Try[B])(g: (B) => A): Aux[AvroType, B]
Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types
A
andB
.Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types
A
andB
.Similar to Codec#imap, except the mapping from
A
toB
might be unsuccessful. - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def toString(): String
- Definition Classes
- Codec → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()