trait Encoder[T] extends SchemaAware[Encoder, T] with Serializable
An Encoder encodes a Scala value of type T into a compatible Avro value based on the given schema.
For example, given a string, and a schema of type Schema.Type.STRING then the string would be encoded as an instance of Utf8, whereas the same string and a Schema.Type.FIXED would be encoded as an instance of GenericFixed.
Another example is given a Scala enumeration value, and a schema of type Schema.Type.ENUM, the value would be encoded as an instance of GenericData.EnumSymbol.
- Self Type
- Encoder[T]
- Alphabetic
- By Inheritance
- Encoder
- Serializable
- SchemaAware
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def encode(value: T): AnyRef
Encodes the given value to a value supported by Avro's generic data model
- abstract def schemaFor: SchemaFor[T]
- Definition Classes
- SchemaAware
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() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def resolveEncoder(env: DefinitionEnvironment[Encoder], update: SchemaUpdate): Encoder[T]
For advanced use only to properly setup Encoder instances for recursive types.
For advanced use only to properly setup Encoder instances for recursive types.
Resolves the Encoder with the provided environment, and (potentially) pushes down overrides from annotations on sealed traits to case classes, or from annotations on parameters to types.
- env
definition environment containing already defined record encoders
- update
schema changes to apply
- def resolveEncoder(): Encoder[T]
produces an Encoder that is guaranteed to be resolved and ready to be used.
produces an Encoder that is guaranteed to be resolved and ready to be used.
This is necessary for properly setting up Encoder instances for recursive types.
- final def schema: Schema
- Definition Classes
- SchemaAware
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withSchema(schemaFor: SchemaFor[T]): Encoder[T]
Creates a variant of this Encoder using the given schema (e.g.
Creates a variant of this Encoder using the given schema (e.g. to use a fixed schema for byte arrays instead of the default bytes schema)
- schemaFor
the schema to use
- Definition Classes
- Encoder → SchemaAware
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated