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
@@ -647,42 +647,96 @@ public QueryBuilder<T> notIn(Property<T> property, int[] values) {
647
647
// String
648
648
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
649
649
650
+ /**
651
+ * Creates an "equal ('=')" condition for this property.
652
+ * <p>
653
+ * Ignores case when matching results, e.g. {@code equal(prop, "example")} matches both "Example" and "example".
654
+ * <p>
655
+ * Use {@link #equal(Property, String, StringOrder) equal(prop, value, StringOrder.CASE_SENSITIVE)} to only match
656
+ * if case is equal.
657
+ * <p>
658
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
659
+ * on {@code property}, dramatically speeding up look-up of results.
660
+ */
650
661
public QueryBuilder <T > equal (Property <T > property , String value ) {
651
662
verifyHandle ();
652
663
checkCombineCondition (nativeEqual (handle , property .getId (), value , false ));
653
664
return this ;
654
665
}
655
666
667
+ /**
668
+ * Creates an "equal ('=')" condition for this property.
669
+ * <p>
670
+ * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only match
671
+ * if case is equal. E.g. {@code equal(prop, "example", StringOrder.CASE_SENSITIVE)} only matches "example",
672
+ * but not "Example".
673
+ * <p>
674
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
675
+ * on {@code property}, dramatically speeding up look-up of results.
676
+ */
656
677
public QueryBuilder <T > equal (Property <T > property , String value , StringOrder order ) {
657
678
verifyHandle ();
658
679
checkCombineCondition (nativeEqual (handle , property .getId (), value , order == StringOrder .CASE_SENSITIVE ));
659
680
return this ;
660
681
}
661
682
683
+ /**
684
+ * Creates a "not equal ('<>')" condition for this property.
685
+ * <p>
686
+ * Ignores case when matching results, e.g. {@code notEqual(prop, "example")} excludes both "Example" and "example".
687
+ * <p>
688
+ * Use {@link #notEqual(Property, String, StringOrder) notEqual(prop, value, StringOrder.CASE_SENSITIVE)} to only exclude
689
+ * if case is equal.
690
+ * <p>
691
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
692
+ * on {@code property}, dramatically speeding up look-up of results.
693
+ */
662
694
public QueryBuilder <T > notEqual (Property <T > property , String value ) {
663
695
verifyHandle ();
664
696
checkCombineCondition (nativeNotEqual (handle , property .getId (), value , false ));
665
697
return this ;
666
698
}
667
699
700
+ /**
701
+ * Creates a "not equal ('<>')" condition for this property.
702
+ * <p>
703
+ * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only exclude
704
+ * if case is equal. E.g. {@code notEqual(prop, "example", StringOrder.CASE_SENSITIVE)} only excludes "example",
705
+ * but not "Example".
706
+ * <p>
707
+ * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
708
+ * on {@code property}, dramatically speeding up look-up of results.
709
+ */
668
710
public QueryBuilder <T > notEqual (Property <T > property , String value , StringOrder order ) {
669
711
verifyHandle ();
670
712
checkCombineCondition (nativeNotEqual (handle , property .getId (), value , order == StringOrder .CASE_SENSITIVE ));
671
713
return this ;
672
714
}
673
715
716
+ /**
717
+ * Ignores case when matching results. Use the overload and pass
718
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
719
+ */
674
720
public QueryBuilder <T > contains (Property <T > property , String value ) {
675
721
verifyHandle ();
676
722
checkCombineCondition (nativeContains (handle , property .getId (), value , false ));
677
723
return this ;
678
724
}
679
725
726
+ /**
727
+ * Ignores case when matching results. Use the overload and pass
728
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
729
+ */
680
730
public QueryBuilder <T > startsWith (Property <T > property , String value ) {
681
731
verifyHandle ();
682
732
checkCombineCondition (nativeStartsWith (handle , property .getId (), value , false ));
683
733
return this ;
684
734
}
685
735
736
+ /**
737
+ * Ignores case when matching results. Use the overload and pass
738
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
739
+ */
686
740
public QueryBuilder <T > endsWith (Property <T > property , String value ) {
687
741
verifyHandle ();
688
742
checkCombineCondition (nativeEndsWith (handle , property .getId (), value , false ));
@@ -707,6 +761,10 @@ public QueryBuilder<T> endsWith(Property<T> property, String value, StringOrder
707
761
return this ;
708
762
}
709
763
764
+ /**
765
+ * Ignores case when matching results. Use the overload and pass
766
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
767
+ */
710
768
public QueryBuilder <T > less (Property <T > property , String value ) {
711
769
return less (property , value , StringOrder .CASE_INSENSITIVE );
712
770
}
@@ -717,6 +775,10 @@ public QueryBuilder<T> less(Property<T> property, String value, StringOrder orde
717
775
return this ;
718
776
}
719
777
778
+ /**
779
+ * Ignores case when matching results. Use the overload and pass
780
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
781
+ */
720
782
public QueryBuilder <T > greater (Property <T > property , String value ) {
721
783
return greater (property , value , StringOrder .CASE_INSENSITIVE );
722
784
}
@@ -727,6 +789,10 @@ public QueryBuilder<T> greater(Property<T> property, String value, StringOrder o
727
789
return this ;
728
790
}
729
791
792
+ /**
793
+ * Ignores case when matching results. Use the overload and pass
794
+ * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
795
+ */
730
796
public QueryBuilder <T > in (Property <T > property , String [] values ) {
731
797
return in (property , values , StringOrder .CASE_INSENSITIVE );
732
798
}
0 commit comments