t

ars.common.enumeration

SerializableEnumValue

trait SerializableEnumValue[EnumValueType <: EnumValue[CodeType], EnumObjectType <: EnumObject[EnumValueType, CodeType], CodeType] extends EnumValue[CodeType] with Serializable

Serializable Scala enumeration value. There're two subclasses SerializableIntEnumValue fro integer codes and SerializableStringEnumValue for string codes.

Example:

sealed abstract class MyEnumValue(val code: Int) extends SerializableIntEnum[MyEnumValue] {
  def valueOf(code: Int): Try[MyEnumValue] = MyEnumValues.valueByCode(code)
}

object MyEnumValues {
  final case object FirstValue extends MyEnumValue(1)
  final case object SecondValue extends MyEnumValue(2)
  final case object ThirdValue extends MyEnumValue(3)

  def valueByCode(code: Int): Try[MyEnumValue] = {
    code match {
      case FirstValue.code  => FirstValue
      case SecondValue.code => SecondValue
      case ThirdValue.code  => ThirdValue
      case _ => Failure(new IllegalArgumentException("Unknown enumeration code"))
    }
  }
}
EnumValueType

the enumeration value type

EnumObjectType

the enumeration object type

CodeType

the code type

Since

0.0.1

Linear Supertypes
Serializable, Serializable, EnumValue[CodeType], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SerializableEnumValue
  2. Serializable
  3. Serializable
  4. EnumValue
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def code: CodeType

    The enum value code.

    The enum value code.

    Definition Classes
    EnumValue
  2. abstract def deserialize(in: ObjectInputStream): CodeType

    Deserializes code from stream.

    Deserializes code from stream.

    in

    the input stream (non-null)

    returns

    the code (non-null)

  3. abstract def objectTypeTag(): scala.reflect.api.JavaUniverse.TypeTag[EnumObjectType]
    Attributes
    protected[this]
  4. abstract def serialize(out: ObjectOutputStream): Unit

    Serializes code to stream.

    Serializes code to stream.

    out

    the output stream (non-null)

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. def name: String

    Gets enum name.

    Gets enum name.

    returns

    enumeration value name (non-null).

    Definition Classes
    EnumValue
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. def readObject(in: ObjectInputStream): Unit
    Annotations
    @throws( ... ) @throws( ... )
  17. def readResolve(): Any
    Annotations
    @throws( ... )
  18. val serializationCode: CodeType
    Attributes
    protected[this]
  19. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String

    Default enumeration implementation of toString.

    Default enumeration implementation of toString.

    It returns string containing enum name following by enum code in round brackets. For example: FirstValue(1)

    Definition Classes
    EnumValue → AnyRef → Any
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  24. def writeObject(out: ObjectOutputStream): Unit
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from EnumValue[CodeType]

Inherited from AnyRef

Inherited from Any

Ungrouped