Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object SampleEnum extends Enumeration {
- val SAMPLE = SampleEnum("sample")
- val SAMPLE2 = SampleEnum(SAMPLE, "sample2")
- class SSampleEnum(val path: String) extends Val(nextId, path)
- class PSSampleEnum(parent: SSampleEnum, override val path: String) extends SSampleEnum(parent.path + "." + path)
- def apply(path: String): SSampleEnum = new SSampleEnum(path)
- def apple(parent: SSampleEnum, path: String): PSSampleEnum = new PSSampleEnum(parent, path)
- }
- scala> SampleEnum.SAMPLE
- res0: Sample.SSampleEnum = sample
- scala> SampleEnum.SAMPLE2
- res1: Sample.PSSampleEnum = sample.sample2
- scala> SampleEnum.SAMPLE.path
- res2: String = sample
- scala> SampleEnum.SAMPLE2.path
- res3: String = sample2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement