Nested ValueEnums don't work
See original GitHub issueI’m converting some of my stuff to the StringEnumEntry, (Thanks!) and I’m noticing a few things I did earlier (With stock EnumEntry) that don’t work with this. It’s quite possible the answers will be “don’t do that”.
I’d set up an object with all the objects associated with a use case. This allowed a single easy import statement to get all the relevant symbols. This doesn’t compile:
sealed abstract class ParameterName(val value: String) extends StringEnumEntry
object ParameterConstants extends StringEnum[ParameterName] {
object FOO extends ParameterName("foo")
override def values = findValues
sealed abstract class FooValue(val value: String) extends StringEnumEntry
object FooValues extends StringEnum[FooValue] {
object A extends FooValue("a")
object B extends FooValue("b")
override def values = findValues
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Can't access enumerands of nested private enum
I'm using Microsoft Visual Studio 2013 to compile a C++ class with some internal state; (let's say) color and texture. Each has a...
Read more >[BUG] docs don't show nested enum attribute for body #329
I have a post method with the body as pydantic object, with one attribute as Enum object; All validation works perfectly; However, ...
Read more >Nested Enums: The What, Why and When | by Steven Curtis
We can add enums within enums, or even within a Struct or a Class in order to make our software design come alive....
Read more >Nested "enum"s should not be declared static
According to the Java Language Specification-8.9: Nested enum types are implicitly static . So there's no need to declare them static explicitly.
Read more >Language Guide (proto3) | Protocol Buffers - Google Developers
Defining A Message Type; Scalar Value Types; Default Values; Enumerations; Using Other Message Types; Nested Types; Updating A Message Type; Unknown Fields ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Agreed. I may look into a prototype to find out when I have time 😉
Added support for this by switching a few things in the way constructor parameters are resolved. Added a test case for it too.
To use it, update to 1.4.11.