This traits provides *all* of the auto-generated functions in EnumApi.
This trait provides conversion from an enumeration to Int.
This trait provides conversion from an enumeration to Int. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends AsInt[Color]
This enables the following two ways to convert Color to a Int.
Red.asInt
Color.asInt(Red) // returns 0
This trait provides conversion from an enumeration to Long.
This trait provides conversion from an enumeration to Long. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends AsLong[Color]
This enables the following two ways to convert Color to a Long.
Red.asLong
Color.asLong(Red) // returns 0L
This trait provides conversion from an enumeration to Short.
This trait provides conversion from an enumeration to Short. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends AsShort[Color]
This enables the following two ways to convert Color to a Short.
Red.asShort
Color.asShort(Red) // returns 0
This trait provides conversion from an enumeration to String.
This trait provides conversion from an enumeration to String. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends AsString[Color]
This enables the following two ways to convert Color to a String.
Red.asString
Color.asString(Red) // returns "Red"
This trait provides conversion from Int to an enumeration.
This trait provides conversion from Int to an enumeration. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends FromInt[Color]
This creates the following function to convert Int to Option[Color].
Color.fromInt(0) // returns Some(Red)
This trait provides conversion from Long to an enumeration.
This trait provides conversion from Long to an enumeration. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends FromLong[Color]
This creates the following function to convert Long to Option[Color].
Color.fromLong(0L) // returns Some(Red)
This trait provides conversion from Short to an enumeration.
This trait provides conversion from Short to an enumeration. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends FromShort[Color]
This creates the following function to convert Short to Option[Color].
Color.fromShort(0 : Short) // returns Some(Red)
This trait provides conversion from String to an enumeration.
This trait provides conversion from String to an enumeration. It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends FromString[Color]
This creates the following function to convert String to Option[Color].
Color.fromString("Red") // returns Some(Red)
This trait provides the Int/E conversions from AsInt and FromInt.
This trait provides the Int/E conversions from AsInt and FromInt.
As with those traits you must extend the companion object of the enumeration.
@enum class Color { Red Blue Yellow } object Color extends IntConverters[Color]
This trait provides the Long/E conversions from AsLong and FromLong.
This trait provides the Long/E conversions from AsLong and FromLong.
As with those traits you must extend the companion object of the enumeration.
@enum class Color { Red Blue Yellow } object Color extends LongConverters[Color]
This trait provides the numeric/enumeration conversions from IntConverters, ShortConverters, and LongConverters.
This trait provides the numeric/enumeration conversions from IntConverters, ShortConverters, and LongConverters.
As with those traits you must extend the companion object of the enumeration.
@enum class Color { Red Blue Yellow } object Color extends NumericConverters[Color]
This trait provides an Ordering instance for an enumeration as well
as functions which use that order.
This trait provides an Ordering instance for an enumeration as well
as functions which use that order. It works by extending the companion
object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends Ordered[Color]
This enables the following functions (and more).
Red < Blue // true Blue.next Color.next(Blue) // yellow Yellow >= Yellow // true Color.first // Red Color.last // Yellow
This traits provides the same interface as Ordered as well as the modular
ordering functions.
This traits provides the same interface as Ordered as well as the modular
ordering functions. As with that trait it works by extending the companion
object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends OrderedModular[Color]
This enables the following functions.
Red.prevMod Color.prevMod(Red) // Yellow Yellow.nextMod Color.nextMod(Yellow) // Red
This trait provides the Short/E conversions from AsShort and FromShort.
This trait provides the Short/E conversions from AsShort and FromShort.
As with those traits you must extend the companion object of the enumeration.
@enum class Color { Red Blue Yellow } object Color extends ShortConverters[Color]
This trait provides the String/E conversions from AsString and FromString.
This trait provides the String/E conversions from AsString and FromString.
As with those traits you must extend the companion object of the enumeration.
@enum class Color { Red Blue Yellow } object Color extends StringConverters[Color]
This traits provides *all* of the auto-generated functions in
EnumApi. It is rare that one actually needs all such functions and it is recommended that you use a smaller subset of these functions as provided by the other traits in themacrame.enumsnamespace.