com.eharmony.aloha.semantics.compiled.plugin.csv

Enum

case class Enum(className: String, constantsAndNumbers: (String, Int)*) extends Dynamic with Product with Serializable

This class is designed to emulate Java enum values created by Google's Protocol Buffer library.

val GenderProto = Enum("com.eharmony.matching.common.value.ProfileProtoBuffs.ProfileProto.GenderProto", "MALE" -> 1, "FEMALE" -> 2)
assert(1 == GenderProto.valueOf("MALE").getNumber)
assert(0 == GenderProto.valueOf("MALE").ordinal)

try { GenderProto.valueOf("HERMAPHRODITE");  throw new Exception("fail") }
catch { case e: IllegalArgumentException => assert(e.getMessage == s"No enum const class ${GenderProto.className}.HERMAPHRODITE") }
className

The canonical class name of the enum being emulated

constantsAndNumbers

the enum constant names and their number (returned by get number).

Linear Supertypes
Serializable, Serializable, Product, Equals, Dynamic, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Enum
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Dynamic
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Enum(className: String, constantsAndNumbers: (String, Int)*)

    className

    The canonical class name of the enum being emulated

    constantsAndNumbers

    the enum constant names and their number (returned by get number).

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. val className: String

    The canonical class name of the enum being emulated

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  16. def selectDynamic(enumConstant: String): EnumConstant

    This function is the dynamic function allowing the caller to get an enum constant.

    This function is the dynamic function allowing the caller to get an enum constant. Unlike with an actual enum, trying to access a non-existent enum constant cannot throw create a compile-time error. It will however generate the same IllegalArgumentException that valueOf does when the enum constant cannot be found.

    NOTE: This function, while exposed publicly, is not intended to be called directly.

    val MyEnum = Enum("test.MyEnum", "V1" -> 1, "V2" -> 2)
    val enumConstant = MyEnum.V1                          // GOOD!
    val sameConstant = MyEnum.selectDynamic("V1")         // BAD!  Instead use MyEnum.valueOf("V1")
    enumConstant

    the enum constant.

    returns

  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  18. def valueOf(enumConstant: String): EnumConstant

    Eumlates the static valueOf(.

    Eumlates the static valueOf(..) function of a java enum. Get the enum constant for the provided enum constant name.

    enumConstant

    the name of an enum constant to retrieve

    returns

    an enum constant value.

    Annotations
    @throws( ... )
  19. def values(): Array[EnumConstant]

    Emulates the static values() function of a java enum.

    Emulates the static values() function of a java enum.

    returns

    an array of enum constants.

  20. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Dynamic

Inherited from AnyRef

Inherited from Any

Ungrouped