Hello Drillers,
I would like to refactor the ExecConstants class in order to group our
property keys by related sections. Neglecting some naming conventions for
the case, we can utilize Java interfaces with fields (which are constants
by default), and create something like:
public interface ExecOption {
interface http {
interface session {
interface memory {
String maximum = "drill.exec.http.session.memory.maximum";
String reservation = "drill.exec.http.session.memory.reservation";
}
}
interface jetty {
interface server {
String acceptors = "drill.exec.http.jetty.server.acceptors";
String selectors = "drill.exec.http.jetty.server.selectors";
}
}
}
}
So then with the help of Java imports, we can write client code like:
config.getLong(http.session.memory.reservation),
config.getLong(http.session.memory.maximum)
As a bonus, IDE's autocomplete and class structure features will allow an
exploration of available choices fairly easily, since all related options
will be related to specific nested interfaces instead of one top-level
class.
Any thoughts and suggestions are highly appreciated :)
Thanks,
Igor