Skip to content

Commit aa2fd2d

Browse files
QueryBuilder: group by type so missing methods are easier to spot.
1 parent 3eec172 commit aa2fd2d

File tree

1 file changed

+55
-35
lines changed

1 file changed

+55
-35
lines changed

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

Lines changed: 55 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -523,98 +523,118 @@ public QueryBuilder<T> equal(Property<T> property, long value) {
523523
return this;
524524
}
525525

526-
public QueryBuilder<T> equal(Property<T> property, boolean value) {
526+
public QueryBuilder<T> notEqual(Property<T> property, long value) {
527527
verifyHandle();
528-
checkCombineCondition(nativeEqual(handle, property.getId(), value ? 1 : 0));
528+
checkCombineCondition(nativeNotEqual(handle, property.getId(), value));
529529
return this;
530530
}
531531

532-
/** @throws NullPointerException if given value is null. Use {@link #isNull(Property)} instead. */
533-
public QueryBuilder<T> equal(Property<T> property, Date value) {
532+
public QueryBuilder<T> less(Property<T> property, long value) {
534533
verifyHandle();
535-
checkCombineCondition(nativeEqual(handle, property.getId(), value.getTime()));
534+
checkCombineCondition(nativeLess(handle, property.getId(), value));
536535
return this;
537536
}
538537

539-
public QueryBuilder<T> notEqual(Property<T> property, long value) {
538+
public QueryBuilder<T> greater(Property<T> property, long value) {
540539
verifyHandle();
541-
checkCombineCondition(nativeNotEqual(handle, property.getId(), value));
540+
checkCombineCondition(nativeGreater(handle, property.getId(), value));
542541
return this;
543542
}
544543

545-
public QueryBuilder<T> notEqual(Property<T> property, boolean value) {
544+
public QueryBuilder<T> between(Property<T> property, long value1, long value2) {
546545
verifyHandle();
547-
checkCombineCondition(nativeNotEqual(handle, property.getId(), value ? 1 : 0));
546+
checkCombineCondition(nativeBetween(handle, property.getId(), value1, value2));
548547
return this;
549548
}
550549

551-
/** @throws NullPointerException if given value is null. Use {@link #isNull(Property)} instead. */
552-
public QueryBuilder<T> notEqual(Property<T> property, Date value) {
550+
// FIXME DbException: invalid unordered_map<K, T> key
551+
public QueryBuilder<T> in(Property<T> property, long[] values) {
553552
verifyHandle();
554-
checkCombineCondition(nativeNotEqual(handle, property.getId(), value.getTime()));
553+
checkCombineCondition(nativeIn(handle, property.getId(), values, false));
555554
return this;
556555
}
557556

558-
public QueryBuilder<T> less(Property<T> property, long value) {
557+
public QueryBuilder<T> notIn(Property<T> property, long[] values) {
559558
verifyHandle();
560-
checkCombineCondition(nativeLess(handle, property.getId(), value));
559+
checkCombineCondition(nativeIn(handle, property.getId(), values, true));
561560
return this;
562561
}
563562

564-
public QueryBuilder<T> greater(Property<T> property, long value) {
563+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
564+
// Integers -> int[]
565+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
566+
567+
public QueryBuilder<T> in(Property<T> property, int[] values) {
565568
verifyHandle();
566-
checkCombineCondition(nativeGreater(handle, property.getId(), value));
569+
checkCombineCondition(nativeIn(handle, property.getId(), values, false));
567570
return this;
568571
}
569572

570-
public QueryBuilder<T> less(Property<T> property, Date value) {
573+
public QueryBuilder<T> notIn(Property<T> property, int[] values) {
571574
verifyHandle();
572-
checkCombineCondition(nativeLess(handle, property.getId(), value.getTime()));
575+
checkCombineCondition(nativeIn(handle, property.getId(), values, true));
573576
return this;
574577
}
575578

576-
/** @throws NullPointerException if given value is null. Use {@link #isNull(Property)} instead. */
577-
public QueryBuilder<T> greater(Property<T> property, Date value) {
579+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
580+
// Integers -> boolean
581+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
582+
583+
public QueryBuilder<T> equal(Property<T> property, boolean value) {
578584
verifyHandle();
579-
checkCombineCondition(nativeGreater(handle, property.getId(), value.getTime()));
585+
checkCombineCondition(nativeEqual(handle, property.getId(), value ? 1 : 0));
580586
return this;
581587
}
582588

583-
public QueryBuilder<T> between(Property<T> property, long value1, long value2) {
589+
public QueryBuilder<T> notEqual(Property<T> property, boolean value) {
584590
verifyHandle();
585-
checkCombineCondition(nativeBetween(handle, property.getId(), value1, value2));
591+
checkCombineCondition(nativeNotEqual(handle, property.getId(), value ? 1 : 0));
586592
return this;
587593
}
588594

589-
/** @throws NullPointerException if one of the given values is null. */
590-
public QueryBuilder<T> between(Property<T> property, Date value1, Date value2) {
595+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
596+
// Integers -> Date
597+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
598+
599+
/**
600+
* @throws NullPointerException if given value is null. Use {@link #isNull(Property)} instead.
601+
*/
602+
public QueryBuilder<T> equal(Property<T> property, Date value) {
591603
verifyHandle();
592-
checkCombineCondition(nativeBetween(handle, property.getId(), value1.getTime(), value2.getTime()));
604+
checkCombineCondition(nativeEqual(handle, property.getId(), value.getTime()));
593605
return this;
594606
}
595607

596-
// FIXME DbException: invalid unordered_map<K, T> key
597-
public QueryBuilder<T> in(Property<T> property, long[] values) {
608+
/**
609+
* @throws NullPointerException if given value is null. Use {@link #isNull(Property)} instead.
610+
*/
611+
public QueryBuilder<T> notEqual(Property<T> property, Date value) {
598612
verifyHandle();
599-
checkCombineCondition(nativeIn(handle, property.getId(), values, false));
613+
checkCombineCondition(nativeNotEqual(handle, property.getId(), value.getTime()));
600614
return this;
601615
}
602616

603-
public QueryBuilder<T> in(Property<T> property, int[] values) {
617+
public QueryBuilder<T> less(Property<T> property, Date value) {
604618
verifyHandle();
605-
checkCombineCondition(nativeIn(handle, property.getId(), values, false));
619+
checkCombineCondition(nativeLess(handle, property.getId(), value.getTime()));
606620
return this;
607621
}
608622

609-
public QueryBuilder<T> notIn(Property<T> property, long[] values) {
623+
/**
624+
* @throws NullPointerException if given value is null. Use {@link #isNull(Property)} instead.
625+
*/
626+
public QueryBuilder<T> greater(Property<T> property, Date value) {
610627
verifyHandle();
611-
checkCombineCondition(nativeIn(handle, property.getId(), values, true));
628+
checkCombineCondition(nativeGreater(handle, property.getId(), value.getTime()));
612629
return this;
613630
}
614631

615-
public QueryBuilder<T> notIn(Property<T> property, int[] values) {
632+
/**
633+
* @throws NullPointerException if one of the given values is null.
634+
*/
635+
public QueryBuilder<T> between(Property<T> property, Date value1, Date value2) {
616636
verifyHandle();
617-
checkCombineCondition(nativeIn(handle, property.getId(), values, true));
637+
checkCombineCondition(nativeBetween(handle, property.getId(), value1.getTime(), value2.getTime()));
618638
return this;
619639
}
620640

0 commit comments

Comments
 (0)