How to approach "private" methods in declarative API interfaces? #2668
natan-abolafya
started this conversation in
General
Replies: 1 comment
-
Yes, this is a bit of a limitation of not supporting abstract class DAOs. Another way to factor this with pure interfaces is to separate the high level and low level operations:
It is a little bit more code but strongly divides the public interfaces from internal ops. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In case what declarative api is isn't clear: https://jdbi.org/#_declarative_api
So I have quite a few of these for some more complex setups:
So, normally, I use the
list()
in the logic part of the code. But it happened a couple times that I made the mistake of callinglistUsersSql()
instead which kind of works until an obscure bug appears later because the relevant relation isn't there. Definitely my fault with the initial method naming really.So, I want to address that by renaming the
listUsersSql
and friends to something less approachable as I can't set themprivate
in an interface. But I can't decide what kind of convention to use. Any ideas there?Or (🦆 effect) should I change those interfaces to classes and go forI forgot that JDBI 3 dropped supporting abstract classes.protected abstract
?Beta Was this translation helpful? Give feedback.
All reactions