Any way to get rid of the val values = findValues boilerplate?
See original GitHub issueHey there,
Nice library!
Wouldn’t it be possible to eliminate the need for
val values = findValues
by simply extending EnumEntry
?
Why is this needed?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Remove the boilerplate | Better world by better software
Let me show how to remove a lot of boilerplate code from your programs, while preserving or even clarifying its meaning.
Read more >boilerplate free projection of case class to change data type of ...
I have an Enumeratum enum and need to load it into a spark data frame. ... Foo extends Enum[Foo] { val values =...
Read more >plokhotnyuk/jsoniter-scala - Gitter
Create case class with default parameter value; Parse JSON that the value does not match the case class parameter variable; Skip the field...
Read more >Validated Configurations with Ciris - Typelevel
In this blog post, we'll take a look at configurations with configuration files, to see how we can make the loading process less...
Read more >KeyValueX: Eliminate boilerplate code and make Android ...
//Configs no longer define a bunch of KEY, VALUE constants and get, put, init static methods, Just a piece of KeyValue static variable:...
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
Hey, I have written a little macro annotation with scalameta:
Does it work for you?
@i-am-the-slime ah yeah, unfortunately we can’t put
findValues
as a lazy val on the base class because the macro expansion gets invoked, at which point the macro doesn’t know what the implementing superclass will be. If I remember correctly, I’ve experimented with this in the past and it seems to work if I make it adef values = findValues
instead, but that means a new list gets constructed on every call, which seems wasteful.@bertderbecker that’s a neat trick 😃