This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://github.com/dadrox/scala.enum for examples in the unit test | |
trait Enum { | |
import java.util.concurrent.atomic.AtomicReference | |
type EnumVal <: Value //This is a type that needs to be found in the implementing class | |
def withName(name: String): Option[EnumVal] = values.find(_.name == name) | |
def withNameIgnoringCase(name: String): Option[EnumVal] = values.find(_.name.equalsIgnoreCase(name)) |