22
22
import java .util .Date ;
23
23
import java .util .List ;
24
24
25
+ import javax .annotation .Nullable ;
26
+
25
27
import io .objectbox .Box ;
26
28
import io .objectbox .EntityInfo ;
27
29
import io .objectbox .Property ;
28
30
import io .objectbox .annotation .apihint .Experimental ;
29
31
import io .objectbox .annotation .apihint .Internal ;
30
32
import io .objectbox .relation .RelationInfo ;
31
33
32
- import javax .annotation .Nullable ;
33
-
34
34
/**
35
35
* With QueryBuilder you define custom queries returning matching entities. Using the methods of this class you can
36
36
* select (filter) results for specific data (for example #{@link #equal(Property, String)} and
@@ -601,42 +601,96 @@ public QueryBuilder<T> notIn(Property<T> property, int[] values) {
601
601
// String
602
602
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
603
603
604
+ /**
605
+ * Creates an "equal ('=')" condition for this property.
606
+ * <p>
607
+ * Ignores case when matching results, e.g. {@code equal(prop, "example")} matches both "Example" and "example".
608
+ * <p>
609
+ * Use {@link #equal(Property, String, StringOrder) equal(prop, value, StringOrder.CASE_SENSITIVE)} to only match
610
+ * if case is equal.
611
+ * <p>
612
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
613
+ * on {@code property}, dramatically speeding up look-up of results.
614
+ */
604
615
public QueryBuilder <T > equal (Property <T > property , String value ) {
605
616
verifyHandle ();
606
617
checkCombineCondition (nativeEqual (handle , property .getId (), value , false ));
607
618
return this ;
608
619
}
609
620
621
+ /**
622
+ * Creates an "equal ('=')" condition for this property.
623
+ * <p>
624
+ * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only match
625
+ * if case is equal. E.g. {@code equal(prop, "example", StringOrder.CASE_SENSITIVE)} only matches "example",
626
+ * but not "Example".
627
+ * <p>
628
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
629
+ * on {@code property}, dramatically speeding up look-up of results.
630
+ */
610
631
public QueryBuilder <T > equal (Property <T > property , String value , StringOrder order ) {
611
632
verifyHandle ();
612
633
checkCombineCondition (nativeEqual (handle , property .getId (), value , order == StringOrder .CASE_SENSITIVE ));
613
634
return this ;
614
635
}
615
636
637
+ /**
638
+ * Creates a "not equal ('<>')" condition for this property.
639
+ * <p>
640
+ * Ignores case when matching results, e.g. {@code notEqual(prop, "example")} excludes both "Example" and "example".
641
+ * <p>
642
+ * Use {@link #notEqual(Property, String, StringOrder) notEqual(prop, value, StringOrder.CASE_SENSITIVE)} to only exclude
643
+ * if case is equal.
644
+ * <p>
645
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
646
+ * on {@code property}, dramatically speeding up look-up of results.
647
+ */
616
648
public QueryBuilder <T > notEqual (Property <T > property , String value ) {
617
649
verifyHandle ();
618
650
checkCombineCondition (nativeNotEqual (handle , property .getId (), value , false ));
619
651
return this ;
620
652
}
621
653
654
+ /**
655
+ * Creates a "not equal ('<>')" condition for this property.
656
+ * <p>
657
+ * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only exclude
658
+ * if case is equal. E.g. {@code notEqual(prop, "example", StringOrder.CASE_SENSITIVE)} only excludes "example",
659
+ * but not "Example".
660
+ * <p>
661
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
662
+ * on {@code property}, dramatically speeding up look-up of results.
663
+ */
622
664
public QueryBuilder <T > notEqual (Property <T > property , String value , StringOrder order ) {
623
665
verifyHandle ();
624
666
checkCombineCondition (nativeNotEqual (handle , property .getId (), value , order == StringOrder .CASE_SENSITIVE ));
625
667
return this ;
626
668
}
627
669
670
+ /**
671
+ * Ignores case when matching results. Use the overload and pass
672
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
673
+ */
628
674
public QueryBuilder <T > contains (Property <T > property , String value ) {
629
675
verifyHandle ();
630
676
checkCombineCondition (nativeContains (handle , property .getId (), value , false ));
631
677
return this ;
632
678
}
633
679
680
+ /**
681
+ * Ignores case when matching results. Use the overload and pass
682
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
683
+ */
634
684
public QueryBuilder <T > startsWith (Property <T > property , String value ) {
635
685
verifyHandle ();
636
686
checkCombineCondition (nativeStartsWith (handle , property .getId (), value , false ));
637
687
return this ;
638
688
}
639
689
690
+ /**
691
+ * Ignores case when matching results. Use the overload and pass
692
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
693
+ */
640
694
public QueryBuilder <T > endsWith (Property <T > property , String value ) {
641
695
verifyHandle ();
642
696
checkCombineCondition (nativeEndsWith (handle , property .getId (), value , false ));
@@ -661,6 +715,10 @@ public QueryBuilder<T> endsWith(Property<T> property, String value, StringOrder
661
715
return this ;
662
716
}
663
717
718
+ /**
719
+ * Ignores case when matching results. Use the overload and pass
720
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
721
+ */
664
722
public QueryBuilder <T > less (Property <T > property , String value ) {
665
723
return less (property , value , StringOrder .CASE_INSENSITIVE );
666
724
}
@@ -671,6 +729,10 @@ public QueryBuilder<T> less(Property<T> property, String value, StringOrder orde
671
729
return this ;
672
730
}
673
731
732
+ /**
733
+ * Ignores case when matching results. Use the overload and pass
734
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
735
+ */
674
736
public QueryBuilder <T > greater (Property <T > property , String value ) {
675
737
return greater (property , value , StringOrder .CASE_INSENSITIVE );
676
738
}
@@ -681,6 +743,10 @@ public QueryBuilder<T> greater(Property<T> property, String value, StringOrder o
681
743
return this ;
682
744
}
683
745
746
+ /**
747
+ * Ignores case when matching results. Use the overload and pass
748
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
749
+ */
684
750
public QueryBuilder <T > in (Property <T > property , String [] values ) {
685
751
return in (property , values , StringOrder .CASE_INSENSITIVE );
686
752
}
0 commit comments