Java interop - consider builders or overloads #223
cyrilou242
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi, if developing lets-plot java API I would go with builders. Building a Java API for lets-plot is clearly out of scope of lets-plot Kotlin API project. However, this might be an interesting community-driven project on itself. Have you considered seeding it? BWT, JetsBrains/Kandy takes (at least partially) the builders approach as I see it. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, thanks for the nice work. I'm trying to use lets-plot in java.
It works well:
But the code is pretty heavy because the lib uses a lot of default parameter values and it results in Java in a single full signature, with all parameters present and all default values lost.
This in Java:
is the same as
in Kotlin.
Setting the same default values manually is prone to error and writing series of nulls is annoying.
Any chance we could consider using
@JvmOverloads
or generate builders?I gave a try to
@JvmOverloads
, it works fine for some simple cases but it quickly gets limited as soon as a few parameter needs to be set. For instance,aes
is the last parameter ingeomPoint
and often needs to be set, so I end up having to use the full signature.So I guess builders are a better solution.
Beta Was this translation helpful? Give feedback.
All reactions