Here is a query language, more specifically, it’s JQL, you can use it in Jira, to search for issues, it’s something like SQL, but quite simpler.
My case is that, I need to construct such queries programmatically, in my application.
Something like:
JQLMachine jqlMachine = new JQLMachine()
jqlMachine.setStatuses("Open", "In Progress")
jqlMachine.setReporter("foouser", "baruser")
jqlMachine.setDateRange(...)
jqlMachine.getQuery() --> String with corresponding JQL query is returned
You get my point I hope. I can imagine the code for this, but it’s not nice, using my current knowledge how I’d do that.
That’s why I’m asking. What you’d advice to use to create such thing. I believe some patterns for creating something like this already exist and there is already best practices, how to do that in good way.
5
You should look into the concept of Object-relational Mapping.
Unfortunately, I doubt an ORM solution has been developed for JQL. It is possible that you can extend an existing ORM package to support JQL.
2
I would recommend Builder/Method chaining like Guava uses for it’s HashCode
and HashFunction
classes.
Hashing Explained
HashCode hc = hf.newHasher()
.putLong(id)
.putString(name)
.putObject(person, personFunnel)
.hash();