Skip to content

Commit 624e28a

Browse files
committed
QueryBuilder.java: group methods in blocks
1 parent 91480d8 commit 624e28a

File tree

1 file changed

+35
-22
lines changed

1 file changed

+35
-22
lines changed

objectbox-java/src/main/java/io/objectbox/query/QueryBuilder.java

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,10 @@ public QueryBuilder<T> notNull(Property<T> property) {
453453
return this;
454454
}
455455

456+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
457+
// Integers
458+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
459+
456460
public QueryBuilder<T> equal(Property<T> property, long value) {
457461
verifyHandle();
458462
checkCombineCondition(nativeEqual(handle, property.getId(), value));
@@ -554,22 +558,20 @@ public QueryBuilder<T> notIn(Property<T> property, int[] values) {
554558
return this;
555559
}
556560

561+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
562+
// String
563+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
564+
557565
public QueryBuilder<T> equal(Property<T> property, String value) {
558566
verifyHandle();
559567
checkCombineCondition(nativeEqual(handle, property.getId(), value, false));
560568
return this;
561569
}
562570

563-
// Help people with floating point equality...
564-
565-
/**
566-
* Floating point equality is non-trivial; this is just a convenience for
567-
* {@link #between(Property, double, double)} with parameters(property, value - tolerance, value + tolerance).
568-
* When using {@link Query#setParameters(Property, double, double)},
569-
* consider that the params are the lower and upper bounds.
570-
*/
571-
public QueryBuilder<T> equal(Property<T> property, double value, double tolerance) {
572-
return between(property, value - tolerance, value + tolerance);
571+
public QueryBuilder<T> equal(Property<T> property, String value, StringOrder order) {
572+
verifyHandle();
573+
checkCombineCondition(nativeEqual(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE));
574+
return this;
573575
}
574576

575577
public QueryBuilder<T> notEqual(Property<T> property, String value) {
@@ -578,6 +580,12 @@ public QueryBuilder<T> notEqual(Property<T> property, String value) {
578580
return this;
579581
}
580582

583+
public QueryBuilder<T> notEqual(Property<T> property, String value, StringOrder order) {
584+
verifyHandle();
585+
checkCombineCondition(nativeNotEqual(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE));
586+
return this;
587+
}
588+
581589
public QueryBuilder<T> contains(Property<T> property, String value) {
582590
verifyHandle();
583591
checkCombineCondition(nativeContains(handle, property.getId(), value, false));
@@ -596,18 +604,6 @@ public QueryBuilder<T> endsWith(Property<T> property, String value) {
596604
return this;
597605
}
598606

599-
public QueryBuilder<T> equal(Property<T> property, String value, StringOrder order) {
600-
verifyHandle();
601-
checkCombineCondition(nativeEqual(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE));
602-
return this;
603-
}
604-
605-
public QueryBuilder<T> notEqual(Property<T> property, String value, StringOrder order) {
606-
verifyHandle();
607-
checkCombineCondition(nativeNotEqual(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE));
608-
return this;
609-
}
610-
611607
public QueryBuilder<T> contains(Property<T> property, String value, StringOrder order) {
612608
verifyHandle();
613609
checkCombineCondition(nativeContains(handle, property.getId(), value, order == StringOrder.CASE_SENSITIVE));
@@ -626,6 +622,23 @@ public QueryBuilder<T> endsWith(Property<T> property, String value, StringOrder
626622
return this;
627623
}
628624

625+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
626+
// Floating point
627+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
628+
629+
630+
// Help people with floating point equality...
631+
632+
/**
633+
* Floating point equality is non-trivial; this is just a convenience for
634+
* {@link #between(Property, double, double)} with parameters(property, value - tolerance, value + tolerance).
635+
* When using {@link Query#setParameters(Property, double, double)},
636+
* consider that the params are the lower and upper bounds.
637+
*/
638+
public QueryBuilder<T> equal(Property<T> property, double value, double tolerance) {
639+
return between(property, value - tolerance, value + tolerance);
640+
}
641+
629642
public QueryBuilder<T> less(Property<T> property, double value) {
630643
verifyHandle();
631644
checkCombineCondition(nativeLess(handle, property.getId(), value));

0 commit comments

Comments
 (0)