Package

com.sksamuel

avro4s

Permalink

package avro4s

Visibility
  1. Public
  2. All

Type Members

  1. case class Anno(className: String, args: Map[String, String]) extends Product with Serializable

    Permalink
  2. class AnnotationExtractors extends AnyRef

    Permalink
  3. case class AvroAlias(alias: String) extends Annotation with AvroAliasable with Product with Serializable

    Permalink
  4. trait AvroAliasable extends Annotation with AvroFieldReflection

    Permalink
  5. class AvroBinaryInputStream[T] extends AvroInputStream[T]

    Permalink

    An implementation of AvroInputStream that reads values of type T written as binary data.

    An implementation of AvroInputStream that reads values of type T written as binary data. See https://avro.apache.org/docs/current/spec.html#binary_encoding

    In order to convert the underlying binary data into types of T, this input stream requires an instance of Decoder.

  6. class AvroDataInputStream[T] extends AvroInputStream[T]

    Permalink
  7. case class AvroDataOutputStream[T](os: OutputStream, schema: Schema, codec: CodecFactory)(implicit encoder: Encoder[T]) extends AvroOutputStream[T] with Product with Serializable

    Permalink

    An AvroOutputStream that writes the schema along with the messages.

    An AvroOutputStream that writes the schema along with the messages. This is usually the format required when writing multiple messages to a single file. Some frameworks, such as a Kafka, store the Schema separately to messages, in which case the AvroBinaryInputStream is what you would need.

    os

    the underlying stream that data will be written to.

  8. case class AvroDoc(doc: String) extends Annotation with AvroDocumentable with Product with Serializable

    Permalink
  9. trait AvroDocumentable extends Annotation with AvroFieldReflection

    Permalink
  10. case class AvroErasedName() extends Annotation with AvroFieldReflection with Product with Serializable

    Permalink

    This annotation is used to disable generics in the encoding of a record's name.

    This annotation is used to disable generics in the encoding of a record's name.

    Normally, the record name for a generic type is the name of the raw type, plus the actual type parameters. For example, a class Foo with type parameters Int and Boolean, would have a generated name of FooInt_Boolean

    When this annotation is present on a type, the name used in the schema will simply be the raw type, eg Foo.

  11. sealed trait AvroFieldReflection extends Annotation with StaticAnnotation

    Permalink
  12. trait AvroFixable extends Annotation with AvroFieldReflection

    Permalink
  13. case class AvroFixed(size: Int) extends Annotation with AvroFixable with Product with Serializable

    Permalink

    AvroFixed overrides the schema type for a field or a value class so that the schema is set to org.apache.avro.Schema.Type.FIXED rather than whatever the default would be.

    AvroFixed overrides the schema type for a field or a value class so that the schema is set to org.apache.avro.Schema.Type.FIXED rather than whatever the default would be.

    This annotation can be used in the following ways:

    - On a field, eg case class Foo(@AvroField(10) name: String) which results in the field name having schema type FIXED with a size of 10.

    - On a value type, eg @AvroField(7) case class Foo(name: String) extends AnyVal which results in all usages of the value type having schema FIXED with a size of 7 rather than the default.

  14. sealed trait AvroFormat extends AnyRef

    Permalink
  15. trait AvroInputStream[T] extends AutoCloseable

    Permalink
  16. class AvroInputStreamBuilder[T] extends AnyRef

    Permalink
  17. class AvroInputStreamBuilderWithSource[T] extends AnyRef

    Permalink
  18. final case class AvroJsonInputStream[T](in: InputStream, writerSchema: Schema, readerSchema: Schema)(implicit decoder: Decoder[T]) extends AvroInputStream[T] with Product with Serializable

    Permalink
  19. case class AvroName(name: String) extends Annotation with AvroNameable with Product with Serializable

    Permalink

    AvroName allows the name used by Avro to be different from what is defined in code.

    AvroName allows the name used by Avro to be different from what is defined in code.

    For example, if a case class defines a field z, such as case class Foo(z: String) then normally this will be serialized as an entry 'z' in the Avro Record.

    However, if the field is annotated such as case class Foo(@AvroName("x") z: String) then the entry in the Avro Record will be for 'x'.

    Similarly for deserialization, if a field is annotated then the name that is looked up in the avro record will be the annotated name and not the field name in Scala.

    The second example is with classes. If a class is annotated with @AvroName then the name used in the record schema will not be the classname but the annotated value.

    This will also have an effect on serialization. For example, when decoding records into an Either, the decoder must decide if the value is a Left or a Right. It usually does this by comparing the name in the record to the classnames of the either types, but when annotated, it will compare the name in the record to the annotated value.

  20. trait AvroNameable extends Annotation with AvroFieldReflection

    Permalink
  21. case class AvroNamespace(namespace: String) extends Annotation with AvroNamespaceable with Product with Serializable

    Permalink
  22. trait AvroNamespaceable extends Annotation with AvroFieldReflection

    Permalink
  23. trait AvroOutputStream[T] extends AutoCloseable

    Permalink

    An AvroOutputStream will write instances of T to an underlying representation.

    An AvroOutputStream will write instances of T to an underlying representation.

    There are three implementations of this stream

    • a Data stream,
    • a Binary stream
    • a Json stream

    See the methods on the companion object to create instances of each of these types of stream.

  24. class AvroOutputStreamBuilder[T] extends AnyRef

    Permalink
  25. class AvroOutputStreamBuilderWithSource[T] extends AnyRef

    Permalink
  26. case class AvroProp(key: String, value: String) extends Annotation with AvroProperty with Product with Serializable

    Permalink
  27. trait AvroProperty extends Annotation with AvroFieldReflection

    Permalink
  28. case class AvroTransient() extends Annotation with StaticAnnotation with Product with Serializable

    Permalink
  29. trait Decoder[T] extends Serializable

    Permalink

    A Decoder is used to convert an Avro value, such as a GenericRecord, SpecificRecord, GenericFixed, EnumSymbol, or a basic JVM type, into a target Scala type.

    A Decoder is used to convert an Avro value, such as a GenericRecord, SpecificRecord, GenericFixed, EnumSymbol, or a basic JVM type, into a target Scala type.

    For example, a Decoder[String] would convert an input of type Utf8 - which is one of the ways Avro can encode strings - into a plain Java String.

    Another example, a decoder for Option[String] would handle inputs of null by emitting a None, and a non-null input by wrapping the decoded value in a Some.

    A final example is converting a GenericData.Array or a Java collection type into a Scala collection type.

  30. class DefaultAvroOutputStream[T] extends AvroOutputStream[T]

    Permalink
  31. class DefaultAwareDatumReader[T] extends GenericDatumReader[T]

    Permalink
  32. class DefaultAwareGenericData extends GenericData

    Permalink
  33. trait Encoder[T] extends Serializable

    Permalink

    An Encoder encodes a Scala value of type T into a compatible Avro value based on the given schema.

    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 GenericData.Fixed.

    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.

  34. final case class Exported[A](instance: A) extends AnyVal with Product with Serializable

    Permalink
  35. trait FromRecord[T] extends Serializable

    Permalink

    Converts from an Avro GenericRecord into instances of T.

  36. case class ImmutableRecord(schema: Schema, values: Vector[AnyRef]) extends Record with Product with Serializable

    Permalink
  37. case class Namer(typeName: TypeName, nameAnnotation: Option[String], namespaceAnnotation: Option[String], erased: Boolean) extends Product with Serializable

    Permalink

    Extracts name and namespace from a TypeName.

    Extracts name and namespace from a TypeName. Takes into consideration provided annotations.

  38. sealed trait NamingStrategy extends AnyRef

    Permalink
  39. trait Record extends GenericRecord with SpecificRecord

    Permalink

    An implementation of org.apache.avro.generic.GenericContainer that is both a GenericRecord and a SpecificRecord.

  40. trait RecordFormat[T] extends ToRecord[T] with FromRecord[T] with Serializable

    Permalink

    Brings together ToRecord and FromRecord in a single interface.

  41. abstract class SafeFrom[T] extends AnyRef

    Permalink
    Attributes
    protected
  42. case class ScalePrecision(scale: Int, precision: Int) extends Product with Serializable

    Permalink
  43. trait SchemaFor[T] extends Serializable

    Permalink

    A SchemaFor generates an Avro Schema for a Scala or Java type.

    A SchemaFor generates an Avro Schema for a Scala or Java type.

    For example, a String SchemaFor could return an instance of Schema.Type.STRING or Schema.Type.FIXED depending on the type required for Strings.

  44. trait ToRecord[T] extends Serializable

    Permalink

    Converts from instances of T into Record's.

    Converts from instances of T into Record's.

    Note: This interface requires that T is marshalled to an Avro GenericRecord / SpecificRecord, and therefore is limited to use by case classes or traits. This interface is essentially just a convenience wrapper around an Encoder so you do not have to cast the result.

    If you wish to convert an avro type other than record use an Encoder directly.

Value Members

  1. object AvroInputStream

    Permalink
  2. object AvroOutputStream

    Permalink
  3. object AvroSchema

    Permalink
  4. object AvroSchemaMerge

    Permalink
  5. object BigDecimals

    Permalink
  6. object BinaryFormat extends AvroFormat

    Permalink
  7. object DataFormat extends AvroFormat

    Permalink
  8. object Decoder extends Serializable

    Permalink
  9. object DefaultAwareDatumReader

    Permalink
  10. object DefaultNamingStrategy extends NamingStrategy with Product with Serializable

    Permalink
  11. object DefaultResolver

    Permalink

    When we set a default on an avro field, the type must match the schema definition.

    When we set a default on an avro field, the type must match the schema definition. For example, if our field has a schema of type UUID, then the default must be a String, or for a schema of Long, then the type must be a java Long and not a Scala long.

    This class will accept a scala value and convert it into a type suitable for Avro and the provided schema.

  12. object Encoder extends Serializable

    Permalink
  13. object FromRecord extends Serializable

    Permalink
  14. object GenericNameEncoder

    Permalink
  15. object JsonFormat extends AvroFormat

    Permalink
  16. object LispCase extends NamingStrategy with Product with Serializable

    Permalink
  17. object Namer extends Serializable

    Permalink
  18. object PascalCase extends NamingStrategy with Product with Serializable

    Permalink
  19. object RecordFormat extends Serializable

    Permalink

    Returns a RecordFormat that will convert to/from instances of T and avro Record's.

  20. object SafeFrom

    Permalink
  21. object ScalePrecision extends Serializable

    Permalink
  22. object SchemaFor extends Serializable

    Permalink
  23. object SchemaHelper

    Permalink
  24. object SnakeCase extends NamingStrategy with Product with Serializable

    Permalink
  25. object SparkSchemas

    Permalink
  26. object ToRecord extends Serializable

    Permalink

Ungrouped