-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: initial commit for overpass wrapper with builder pattern #1
base: master
Are you sure you want to change the base?
WIP: initial commit for overpass wrapper with builder pattern #1
Conversation
- four main query builder classes ComplexQuery, NodeQuery, WayQuery and RelationQuery - three option builder classes for header settings (Settings), regional search requests (SearchRegion) and for filter tags (Tags) - six sign specific enums to define verbosity level (Verbosity), geometries (GeometryType), comparison filters for tags (Filter), possible regional search types (SearchType), input specific selection types (Selection) and output specific modifier (Modifier) - two additional statement classes to allow recursion (Recursion) and building resulting sets (Sets) - three base type as interfaces and abstract classes to give the four main classes and the additional statements an architecture
This is just work in progress. README still needs to be adjusted to the new style and some examples should be presented. I also didn't test the OverpassResponse yet if it fits all the verbosity levels and geometry types. |
Great 👍 I think I will have time to review it |
Sorry, I am still too busy. Do not take this personally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the huge and great pull request. As we already spoke in person about this you know that I was taking an almost infinite time to review it. I hope you find my comments somewhat helpful. Please take your time to go through them. I will be happy to reply to any questions you have concerning them.
Test syntax
Did you see that I added AssertJ as a dependency? You might want to use it to make assertions more readable. Example:
Assert.assertEquals(expected, actual);
becomes:
assertThat(actual).isEqualTo(expected);
for (double coordinate : coordinates) { | ||
coo.add(String.valueOf(coordinate)); | ||
} | ||
return String.join(delimiter, coo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with StringUtils.join
.
* @return String | ||
*/ | ||
public String create() { | ||
return String.join("", tags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with StringUtils.join
.
tail.add(String.valueOf(limit)); | ||
} | ||
|
||
return String.join(" ", tail); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with StringUtils.join
.
* COUNT Get the element count. | ||
*/ | ||
public enum Modifier { | ||
BB("bb"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you know I am not into the internals over the overpass query language. But as a library user I would love to see an a bit more verbose name for this enum. Maybe BBOX
or even BOUNDING_BOX
. In the end it should match what is defined in SearchType
.
package info.metadude.java.library.overpass.models.query.enums; | ||
|
||
/** | ||
* Degree of verbosity, default is body. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this enum class define a default?
LIKE("\"~\""), | ||
NOTLIKE("\"!~\""); | ||
|
||
public String sign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add final
.
BACKWARD_WAY("bw"), | ||
BACKWARD_RELATION("br"); | ||
|
||
public String sign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add final
.
IDS("ids"), | ||
TAGS("tags"); | ||
|
||
public String sign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add final
.
GEOM("geom"), | ||
COUNT("count"); | ||
|
||
public String sign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add final
.
/** | ||
* Tag request clauses (or "tag filters") | ||
*/ | ||
public enum Filter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability reasons I suggest adding _
in the enum values such as NOT_EQUAL
instead of NOTEQUAL
.
- introduction part in README to new lib design
Still Todo
|
@johnjohndoe I still have two major problems. The first one is related to testing, I can't use the test suite integrated into Android Studio and have to test always just with The second problem has no work around. I don't know how to fix the following Travis error |
…d comments still missing
-- header settings (Settings)
-- regional search requests (SearchRegion)
-- filter tags (Tags)
-- verbosity level (Verbosity)
-- geometries (GeometryType)
-- comparison filters for tags (Filter)
-- possible regional search types (SearchType)
-- input specific selection types (Selection)
-- output specific modifier (Modifier)