Package

com.avsystem.commons

serialization

Permalink

package serialization

Visibility
  1. Public
  2. All

Type Members

  1. class name extends Annotation with StaticAnnotation

    Permalink

    Can be used on case class fields and classes in sealed hierarchy to instruct automatically derived GenCodec to use particular name instead of just using parameter or class name.

    Can be used on case class fields and classes in sealed hierarchy to instruct automatically derived GenCodec to use particular name instead of just using parameter or class name.

    For example:

    case class Something(@name("dbname") paramname: Int)
    object Something {
      implicit codec = GenCodec.auto[Something]
    }

    GenCodec.write(someOutput, Something(42)) would write an object {"dbname": 42} instead of {"paramname": 42}.

  2. class transientDefault extends Annotation with StaticAnnotation

    Permalink

    If some case class field has default value, you can use this annotation on this field to instruct an automatically derived GenCodec to not persist the value of that field if it's equal to the default value.

    If some case class field has default value, you can use this annotation on this field to instruct an automatically derived GenCodec to not persist the value of that field if it's equal to the default value.

    For example:

    case class Something(str: String, @transientDefault int: Int = 42)
    object Something {
      implicit val codec = GenCodec.auto[Something]
    }

    GenCodec.write(someOutput, Something("lol", 10)) would yield object {"str": "lol", "int": 10} but GenCodec.write(someOutput, Something("lol", 42)) would yield object {"str": "lol"} because the value of int is the same as the default value.

  3. class transparent extends Annotation with StaticAnnotation

    Permalink

    Can be used on case classes with exactly one field to instruct automatically generated GenCodec that the class is a "transparent wrapper" and should be serialized to the same representation as the value of its sole field.

Ungrouped