p

ars.common

enumeration

package enumeration

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractSerializableIntEnumValue[EnumValueType <: EnumValue[Int], EnumObjectType <: EnumObject[EnumValueType, Int]] extends SerializableIntEnumValue[EnumValueType, EnumObjectType]

    Serializable to Int Scala enumeration value implementation.

    Serializable to Int Scala enumeration value implementation. This abstract class already implements method objectTypeTag() of SerializableIntEnumValue.

    EnumValueType

    the enumeration value type

    EnumObjectType

    the enumeration object type

    Since

    0.0.1

  2. 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

  3. 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

  4. 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

  5. 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

  6. trait SerializableIntEnumValue[EnumValueType <: EnumValue[Int], EnumObjectType <: EnumObject[EnumValueType, Int]] extends SerializableEnumValue[EnumValueType, EnumObjectType, Int]

    Serializable to Int Scala enumeration value.

    Serializable to Int Scala enumeration value. To use this trait you need to implement method objectTypeTag().

    EnumValueType

    the enumeration value type

    EnumObjectType

    the enumeration object type

    Since

    0.0.1

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

  1. object EnumObjectRequireUtils extends Require

    Utility object to test EnumObject preconditions.

    Utility object to test EnumObject preconditions.

    Attributes
    protected
    Since

    0.0.1

Ungrouped