Packages

c

org.virtuslab.ash.circe

CirceAkkaSerializer

abstract class CirceAkkaSerializer[Ser <: AnyRef] extends SerializerWithStringManifest with AkkaCodecs

An abstract class that is extended to create a custom serializer.

After creating your subclass, don't forget to add your serializer and base trait to application.conf (for more info https://doc.akka.io/docs/akka/2.5.32//serialization.html)

Example subclass:

class CustomSerializer(actorSystem: ExtendedActorSystem) extends CirceAkkaSerializer[MySerializable](actorSystem) {

  implicit private val serializabilityCodec: Codec[MySerializable] = genericCodec

  override def identifier: Int = 41

  override lazy val codecs =
    Seq(
      Register[SthCommand],
      Register(implicitly[ru.TypeTag[ModifiedCodec]], prepareEncoder, prepareDecoder),
      Register[GenericClass[MySerializable, MySerializable]])

  override lazy val manifestMigrations = Seq("app.OldName" -> classOf[TopTraitMigration])

  override lazy val packagePrefix = "app"
}
Ser

base trait that is used to mark serialization

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CirceAkkaSerializer
  2. AkkaCodecs
  3. SerializerWithStringManifest
  4. Serializer
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CirceAkkaSerializer(system: ExtendedActorSystem)(implicit arg0: ClassTag[Ser])

    system

    ExtendedActorSystem that is provided by Akka

Abstract Value Members

  1. abstract val codecs: Seq[Registration[_ <: Ser]]

    Sequence that must contain org.virtuslab.ash.circe.Registration for all direct subclasses of Ser.

    Sequence that must contain org.virtuslab.ash.circe.Registration for all direct subclasses of Ser.

    Each Registration is created using org.virtuslab.ash.circe.Registers org.virtuslab.ash.circe.Register#apply method.

    To check if all needed classes are registered, use Codec Registration Checker.

    See also

    org.virtuslab.ash.circe.Registerorg.virtuslab.ash.circe.Register#apply for more information about type derivation

  2. abstract def identifier: Int
    Definition Classes
    SerializerWithStringManifest → Serializer
  3. abstract val manifestMigrations: Seq[(String, Class[_])]

    A sequence containing information used in type migration.

    A sequence containing information used in type migration.

    If you ever change the name of a class that is a direct descendant of Ser and is persisted in any way, you must append new pair to this field.

    • The first element of the pair is a String with the value of old FQCN.
    • The second element of the pair is a class that had its name changed

    Example:

    override lazy val manifestMigrations = Seq(
     "app.OldName" -> classOf[app.NewName]
    )
  4. abstract val packagePrefix: String

    Package prefix of your project.

    Package prefix of your project. Ensure that Ser is included in that package and as many classes that extend it.

    It should look something like "org.group.project"

    It is used for some runtime checks that are executed near the end of initialisation by Akka.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. implicit def actorRefCodec[T](implicit system: ActorSystem = serializationSystem): Codec[ActorRef[T]]
    Definition Classes
    AkkaCodecs
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. def fromBinary(bytes: Array[Byte], manifest: String): AnyRef
    Definition Classes
    CirceAkkaSerializer → SerializerWithStringManifest
  11. final def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef
    Definition Classes
    SerializerWithStringManifest → Serializer
  12. final def fromBinary(bytes: Array[Byte], clazz: Class[_]): AnyRef
    Definition Classes
    Serializer
    Annotations
    @throws( ... )
  13. final def fromBinary(bytes: Array[Byte]): AnyRef
    Definition Classes
    Serializer
  14. def genericCodec: Codec[Ser]

    The intended usage of this method is to provide any form of support for generic classes.

    The intended usage of this method is to provide any form of support for generic classes.

    Because of type erasure, it's impossible to org.virtuslab.ash.circe.Register one generic class two times with different type parameters.

    The trick for combating type erasure is to register generic class only once with type parameter being its upper bound, and provide custom made io.circe.Codec that can serialize/deserialize all classes that are used as a type parameter.

    For example, if the upper bound is Any, but you know that only Int and String are used as a type parameter, then you can create a custom io.circe.Codec for Any that handles Int and String and throws Exception otherwise.

    To use this method correctly, set the upper bound for the type parameter of generic class to Ser and put the returned Codec as implicit in a place that can be seen by type derivation.

    Example of generic class:

    case class GenericClass[A <: MySerializable, B <: MySerializable](a: A, b: B) extends MySerializable

    and its registration in serializer:

    Register[GenericClass[MySerializable, MySerializable]]
    returns

    io.circe.Codec that can serialize all subtypes of Ser

    Attributes
    protected
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. final def includeManifest: Boolean
    Definition Classes
    SerializerWithStringManifest → Serializer
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def manifest(o: AnyRef): String
    Definition Classes
    CirceAkkaSerializer → SerializerWithStringManifest
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. implicit def sinkRefCodec[T](implicit system: ActorSystem = serializationSystem): Codec[SinkRef[T]]
    Definition Classes
    AkkaCodecs
  24. implicit def sourceRefCodec[T](implicit system: ActorSystem = serializationSystem): Codec[SourceRef[T]]
    Definition Classes
    AkkaCodecs
  25. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  26. def toBinary(o: AnyRef): Array[Byte]
    Definition Classes
    CirceAkkaSerializer → SerializerWithStringManifest → Serializer
  27. def toString(): String
    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AkkaCodecs

Inherited from Serializer

Inherited from AnyRef

Inherited from Any

Ungrouped