Skip to content

Commit c081ec9

Browse files
add oracle jdk 11 build test, update javadocs
1 parent 32f9a88 commit c081ec9

2 files changed

Lines changed: 60 additions & 43 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ language: java
33
sudo: false
44

55
jdk:
6+
- oraclejdk11
67
- openjdk11
78

89
cache:

src/main/java/com/joonsang/graylog/GraylogQuery.java

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public GraylogQuery append(GraylogQuery query) {
6060
}
6161

6262
/**
63-
* Messages that include the term or phrase
63+
* Messages that include the term or phrase.
6464
* @param value term or phrase
65-
* @return GraylogQuery object
65+
* @return GraylogQuery - used to chain calls
6666
* @since 1.0.0
6767
*/
6868
public GraylogQuery term(String value) {
@@ -78,10 +78,10 @@ public GraylogQuery term(String value) {
7878
}
7979

8080
/**
81-
* Fuzziness with default distance
82-
* : Messages that include similar term or phrase
81+
* Fuzziness with default distance.
82+
* Messages that include similar term or phrase.
8383
* @param value term or phrase
84-
* @return GraylogQuery object
84+
* @return GraylogQuery - used to chain calls
8585
* @since 1.0.0
8686
*/
8787
public GraylogQuery fuzzTerm(String value) {
@@ -97,11 +97,11 @@ public GraylogQuery fuzzTerm(String value) {
9797
}
9898

9999
/**
100-
* Fuzziness with custom distance
101-
* : Messages that include similar term or phrase
100+
* Fuzziness with custom distance.
101+
* Messages that include similar term or phrase.
102102
* @param value term or phrase
103103
* @param distance Damerau-Levenshtein distance
104-
* @return GraylogQuery object
104+
* @return GraylogQuery - used to chain calls
105105
* @since 1.0.0
106106
*/
107107
public GraylogQuery fuzzTerm(String value, int distance) {
@@ -117,9 +117,9 @@ public GraylogQuery fuzzTerm(String value, int distance) {
117117
}
118118

119119
/**
120-
* Messages that have the field
120+
* Messages that have the field.
121121
* @param field field name
122-
* @return GraylogQuery object
122+
* @return GraylogQuery - used to chain calls
123123
* @since 1.0.0
124124
*/
125125
public GraylogQuery exists(String field) {
@@ -129,10 +129,10 @@ public GraylogQuery exists(String field) {
129129
}
130130

131131
/**
132-
* Messages where the field includes the term or phrase
132+
* Messages where the field includes the term or phrase.
133133
* @param field field name
134134
* @param value term or phrase
135-
* @return GraylogQuery object
135+
* @return GraylogQuery - used to chain calls
136136
* @since 1.0.0
137137
*/
138138
public GraylogQuery field(String field, String value) {
@@ -148,10 +148,10 @@ public GraylogQuery field(String field, String value) {
148148
}
149149

150150
/**
151-
* Messages where the field includes the number
151+
* Messages where the field includes the number.
152152
* @param field field name
153153
* @param value number
154-
* @return GraylogQuery object
154+
* @return GraylogQuery - used to chain calls
155155
* @since 1.0.0
156156
*/
157157
public GraylogQuery field(String field, int value) {
@@ -161,12 +161,12 @@ public GraylogQuery field(String field, int value) {
161161
}
162162

163163
/**
164-
* One side unbounded range query
165-
* : Messages where the field satisfies the condition
164+
* One side unbounded range query.
165+
* Messages where the field satisfies the condition.
166166
* @param field field name
167167
* @param operator range operator
168168
* @param value number
169-
* @return GraylogQuery object
169+
* @return GraylogQuery - used to chain calls
170170
* @since 1.0.0
171171
*/
172172
public GraylogQuery field(String field, String operator, int value) {
@@ -176,11 +176,11 @@ public GraylogQuery field(String field, String operator, int value) {
176176
}
177177

178178
/**
179-
* Fuzziness with default distance
180-
* : Messages where the field includes similar term or phrase
179+
* Fuzziness with default distance.
180+
* Messages where the field includes similar term or phrase.
181181
* @param field field name
182182
* @param value number
183-
* @return GraylogQuery object
183+
* @return GraylogQuery - used to chain calls
184184
* @since 1.0.0
185185
*/
186186
public GraylogQuery fuzzField(String field, String value) {
@@ -196,12 +196,12 @@ public GraylogQuery fuzzField(String field, String value) {
196196
}
197197

198198
/**
199-
* Fuzziness with custom distance
200-
* : Messages where the field includes similar term or phrase
199+
* Fuzziness with custom distance.
200+
* Messages where the field includes similar term or phrase.
201201
* @param field field name
202202
* @param value number
203203
* @param distance Damerau-Levenshtein distance
204-
* @return GraylogQuery object
204+
* @return GraylogQuery - used to chain calls
205205
* @since 1.0.0
206206
*/
207207
public GraylogQuery fuzzField(String field, String value, int distance) {
@@ -217,14 +217,14 @@ public GraylogQuery fuzzField(String field, String value, int distance) {
217217
}
218218

219219
/**
220-
* Range query
221-
* : Ranges in square brackets are inclusive, curly brackets are exclusive and can even be combined
220+
* Range query.
221+
* Ranges in square brackets are inclusive, curly brackets are exclusive and can even be combined.
222222
* @param field field name
223223
* @param fromBracket from bracket
224224
* @param from from number
225225
* @param to to number
226226
* @param toBracket to bracket
227-
* @return GraylogQuery object
227+
* @return GraylogQuery - used to chain calls
228228
* @since 1.0.0
229229
*/
230230
public GraylogQuery range(String field, String fromBracket, int from, int to, String toBracket) {
@@ -234,14 +234,14 @@ public GraylogQuery range(String field, String fromBracket, int from, int to, St
234234
}
235235

236236
/**
237-
* Date range query
238-
* : The dates needs to be UTC
237+
* Date range query.
238+
* The dates needs to be UTC.
239239
* @param field field name
240240
* @param fromBracket from bracket
241241
* @param from from date
242242
* @param to to date
243243
* @param toBracket to bracket
244-
* @return GraylogQuery object
244+
* @return GraylogQuery - used to chain calls
245245
* @since 1.0.0
246246
*/
247247
public GraylogQuery range(String field, String fromBracket, String from, String to, String toBracket) {
@@ -254,9 +254,9 @@ public GraylogQuery range(String field, String fromBracket, String from, String
254254
}
255255

256256
/**
257-
* Raw query
257+
* Raw query.
258258
* @param raw raw Graylog query
259-
* @return GraylogQuery object
259+
* @return GraylogQuery - used to chain calls
260260
* @since 1.0.0
261261
*/
262262
public GraylogQuery raw(String raw) {
@@ -266,8 +266,8 @@ public GraylogQuery raw(String raw) {
266266
}
267267

268268
/**
269-
* NOT expression
270-
* @return GraylogQuery object
269+
* NOT expression.
270+
* @return GraylogQuery - used to chain calls
271271
* @since 1.0.0
272272
*/
273273
public GraylogQuery not() {
@@ -277,8 +277,8 @@ public GraylogQuery not() {
277277
}
278278

279279
/**
280-
* AND expression
281-
* @return GraylogQuery object
280+
* AND expression.
281+
* @return GraylogQuery - used to chain calls
282282
* @since 1.0.0
283283
*/
284284
public GraylogQuery and() {
@@ -288,8 +288,8 @@ public GraylogQuery and() {
288288
}
289289

290290
/**
291-
* OR expression
292-
* @return GraylogQuery object
291+
* OR expression.
292+
* @return GraylogQuery - used to chain calls
293293
* @since 1.0.0
294294
*/
295295
public GraylogQuery or() {
@@ -299,8 +299,8 @@ public GraylogQuery or() {
299299
}
300300

301301
/**
302-
* Open parenthesis
303-
* @return GraylogQuery object
302+
* Open parenthesis.
303+
* @return GraylogQuery - used to chain calls
304304
* @since 1.0.0
305305
*/
306306
public GraylogQuery openParen() {
@@ -310,8 +310,8 @@ public GraylogQuery openParen() {
310310
}
311311

312312
/**
313-
* Close parenthesis
314-
* @return GraylogQuery object
313+
* Close parenthesis.
314+
* @return GraylogQuery - used to chain calls
315315
* @since 1.0.0
316316
*/
317317
public GraylogQuery closeParen() {
@@ -321,8 +321,8 @@ public GraylogQuery closeParen() {
321321
}
322322

323323
/**
324-
* Completed Graylog query
325-
* @return Completed Graylog query
324+
* Completed Graylog query.
325+
* @return completed Graylog query
326326
* @since 1.0.0
327327
*/
328328
public String build() {
@@ -331,6 +331,10 @@ public String build() {
331331
return StringUtils.join(queries, StringUtils.SPACE);
332332
}
333333

334+
/**
335+
* Remove the conjunction at the end.
336+
* @since 1.0.0
337+
*/
334338
private void removeEndingConj() {
335339
if (queries.isEmpty()) {
336340
return;
@@ -345,6 +349,10 @@ private void removeEndingConj() {
345349
}
346350
}
347351

352+
/**
353+
* Remove the starting conjunction.
354+
* @since 1.0.0
355+
*/
348356
private void removeStartingConj() {
349357
if (queries.isEmpty()) {
350358
return;
@@ -363,6 +371,10 @@ private void removeStartingConj() {
363371
}
364372
}
365373

374+
/**
375+
* Sanitize string value.
376+
* @since 1.0.0
377+
*/
366378
private String sanitize(String value) {
367379
if (StringUtils.isEmpty(value)) {
368380
return value;
@@ -371,6 +383,10 @@ private String sanitize(String value) {
371383
return "\"" + escape(value) + "\"";
372384
}
373385

386+
/**
387+
* Escape input text as specified on Graylog docs.
388+
* @since 1.0.0
389+
*/
374390
private String escape(String input) {
375391
final String[] metaCharacters = {
376392
"&", "|", ":", "\\", "/", "+", "-", "!", "(", ")", "{", "}", "[", "]", "^", "\"", "~", "*", "?"

0 commit comments

Comments
 (0)