package enumeration
- Alphabetic
- Public
- All
Type Members
-
abstract
class
AbstractSerializableIntEnumValue[EnumValueType <: EnumValue[Int], EnumObjectType <: EnumObject[EnumValueType, Int]] extends SerializableIntEnumValue[EnumValueType, EnumObjectType]
Serializable to
IntScala enumeration value implementation.Serializable to
IntScala enumeration value implementation. This abstract class already implements methodobjectTypeTag()of SerializableIntEnumValue.- EnumValueType
the enumeration value type
- EnumObjectType
the enumeration object type
- Since
0.0.1
-
abstract
class
AbstractSerializableStringEnumValue[EnumValueType <: EnumValue[String], EnumObjectType <: EnumObject[EnumValueType, String]] extends SerializableStringEnumValue[EnumValueType, EnumObjectType]
Serializable to String Scala enumeration value.
Serializable to String Scala enumeration value.
- EnumValueType
the enumeration value type
- EnumObjectType
the enumeration object type
- Since
0.0.1
-
trait
EnumObject[EnumValueType <: EnumValue[CodeType], CodeType] extends AnyRef
Enumeration object base trait.
Enumeration object base trait.
- EnumValueType
the enumeration type
- CodeType
the enumeration code type
- Since
0.0.1
-
trait
EnumValue[CodeType] extends AnyRef
Enumeration value base trait.
Enumeration value base trait.
Example:
sealed abstract class MyEnumValue(override val code: Int) extends EnumValue[Int] object MyEnumValues extends EnumObject[MyEnumValue, Int] { final case object FirstValue extends MyEnumValue(1) final case object SecondValue extends MyEnumValue(2) final case object ThirdValue extends MyEnumValue(3) override def values: Seq[MyEnumValue] = Seq(FirstValue, SecondValue, ThirdValue) }
- CodeType
the enumeration code type
- Since
0.0.1
-
trait
SerializableEnumValue[EnumValueType <: EnumValue[CodeType], EnumObjectType <: EnumObject[EnumValueType, CodeType], CodeType] extends EnumValue[CodeType] with Serializable
Serializable Scala enumeration value.
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
-
trait
SerializableIntEnumValue[EnumValueType <: EnumValue[Int], EnumObjectType <: EnumObject[EnumValueType, Int]] extends SerializableEnumValue[EnumValueType, EnumObjectType, Int]
Serializable to
IntScala enumeration value.Serializable to
IntScala enumeration value. To use this trait you need to implement methodobjectTypeTag().- EnumValueType
the enumeration value type
- EnumObjectType
the enumeration object type
- Since
0.0.1
-
trait
SerializableStringEnumValue[EnumType <: EnumValue[String], EnumObjectType <: EnumObject[EnumType, String]] extends SerializableEnumValue[EnumType, EnumObjectType, String]
Serializable to String Scala enumeration value.
Serializable to String Scala enumeration value. To use this trait you need to implement method
objectTypeTag().- EnumType
the enumeration value type
- EnumObjectType
the enumeration object type
- Since
0.0.1
Value Members
-
object
EnumObjectRequireUtils extends Require
Utility object to test EnumObject preconditions.
Utility object to test EnumObject preconditions.
- Attributes
- protected
- Since
0.0.1