3838 *
3939 * <pre>
4040 * userBox.query()
41- * .equal(User_.firstName, "Joe")
41+ * .equal(User_.firstName, "Joe", StringOrder.CASE_SENSITIVE )
4242 * .order(User_.lastName)
4343 * .build()
4444 * .find()
4545 * </pre>
4646 *
4747 * <p>
48- * To add a condition use the appropriate method, for example {@link #equal(Property, String)} or
48+ * To add a condition use the appropriate method, for example {@link #equal(Property, String, StringOrder )} or
4949 * {@link #isNull(Property)}. To order results use {@link #order(Property)} and its related methods.
5050 * <p>
5151 * Use {@link #build()} to create a {@link Query} object, which is used to actually get the results.
@@ -70,10 +70,11 @@ public enum StringOrder {
7070 CASE_INSENSITIVE ,
7171
7272 /**
73- * Checks case of ASCII characters when macthing results,
73+ * Checks case of ASCII characters when matching results,
7474 * e.g. the condition "= example" only matches "example", but not "Example".
7575 * <p>
76- * Use this if the property has an index.
76+ * Use this if the property has an {@link io.objectbox.annotation.Index @Index}
77+ * to dramatically increase the speed of looking-up results.
7778 */
7879 CASE_SENSITIVE
7980 }
@@ -449,7 +450,7 @@ public QueryBuilder<T> eager(int limit, RelationInfo relationInfo, @Nullable Rel
449450
450451 /**
451452 * Sets a filter that executes on primary query results (returned from the db core) on a Java level.
452- * For efficiency reasons, you should always prefer primary criteria like {@link #equal(Property, String )} if
453+ * For efficiency reasons, you should always prefer primary criteria like {@link #equal(Property, long )} if
453454 * possible.
454455 * A filter requires to instantiate full Java objects beforehand, which is less efficient.
455456 * <p>
@@ -733,30 +734,6 @@ public QueryBuilder<T> between(Property<T> property, Date value1, Date value2) {
733734
734735 /**
735736 * Creates an "equal ('=')" condition for this property.
736- * <p>
737- * Ignores case when matching results, e.g. {@code equal(prop, "example")} matches both "Example" and "example".
738- * <p>
739- * Use {@link #equal(Property, String, StringOrder) equal(prop, value, StringOrder.CASE_SENSITIVE)} to only match
740- * if case is equal.
741- * <p>
742- * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
743- * on {@code property}, dramatically speeding up look-up of results.
744- */
745- public QueryBuilder <T > equal (Property <T > property , String value ) {
746- verifyHandle ();
747- checkCombineCondition (nativeEqual (handle , property .getId (), value , false ));
748- return this ;
749- }
750-
751- /**
752- * Creates an "equal ('=')" condition for this property.
753- * <p>
754- * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only match
755- * if case is equal. E.g. {@code equal(prop, "example", StringOrder.CASE_SENSITIVE)} only matches "example",
756- * but not "Example".
757- * <p>
758- * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
759- * on {@code property}, dramatically speeding up look-up of results.
760737 */
761738 public QueryBuilder <T > equal (Property <T > property , String value , StringOrder order ) {
762739 verifyHandle ();
@@ -766,30 +743,6 @@ public QueryBuilder<T> equal(Property<T> property, String value, StringOrder ord
766743
767744 /**
768745 * Creates a "not equal ('<>')" condition for this property.
769- * <p>
770- * Ignores case when matching results, e.g. {@code notEqual(prop, "example")} excludes both "Example" and "example".
771- * <p>
772- * Use {@link #notEqual(Property, String, StringOrder) notEqual(prop, value, StringOrder.CASE_SENSITIVE)} to only exclude
773- * if case is equal.
774- * <p>
775- * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
776- * on {@code property}, dramatically speeding up look-up of results.
777- */
778- public QueryBuilder <T > notEqual (Property <T > property , String value ) {
779- verifyHandle ();
780- checkCombineCondition (nativeNotEqual (handle , property .getId (), value , false ));
781- return this ;
782- }
783-
784- /**
785- * Creates a "not equal ('<>')" condition for this property.
786- * <p>
787- * Set {@code order} to {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to only exclude
788- * if case is equal. E.g. {@code notEqual(prop, "example", StringOrder.CASE_SENSITIVE)} only excludes "example",
789- * but not "Example".
790- * <p>
791- * Note: Use a case sensitive condition to utilize an {@link io.objectbox.annotation.Index @Index}
792- * on {@code property}, dramatically speeding up look-up of results.
793746 */
794747 public QueryBuilder <T > notEqual (Property <T > property , String value , StringOrder order ) {
795748 verifyHandle ();
@@ -798,56 +751,32 @@ public QueryBuilder<T> notEqual(Property<T> property, String value, StringOrder
798751 }
799752
800753 /**
801- * Ignores case when matching results. Use the overload and pass
802- * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
754+ * Creates an contains condition.
803755 * <p>
804756 * Note: for a String array property, use {@link #containsElement} instead.
805757 */
806- public QueryBuilder <T > contains (Property <T > property , String value ) {
758+ public QueryBuilder <T > contains (Property <T > property , String value , StringOrder order ) {
807759 if (String [].class == property .type ) {
808760 throw new UnsupportedOperationException ("For String[] only containsElement() is supported at this time." );
809761 }
810- verifyHandle ();
811- checkCombineCondition (nativeContains (handle , property .getId (), value , false ));
762+ containsNoTypeCheck (property , value , order );
812763 return this ;
813764 }
814765
815766 /**
816767 * For a String array property, matches if at least one element equals the given value.
817768 */
818- public QueryBuilder <T > containsElement (Property <T > property , String value ) {
769+ public QueryBuilder <T > containsElement (Property <T > property , String value , StringOrder order ) {
819770 if (String [].class != property .type ) {
820771 throw new IllegalArgumentException ("containsElement is only supported for String[] properties." );
821772 }
822- verifyHandle ();
823- checkCombineCondition (nativeContains (handle , property .getId (), value , false ));
773+ containsNoTypeCheck (property , value , order );
824774 return this ;
825775 }
826776
827- /**
828- * Ignores case when matching results. Use the overload and pass
829- * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
830- */
831- public QueryBuilder <T > startsWith (Property <T > property , String value ) {
832- verifyHandle ();
833- checkCombineCondition (nativeStartsWith (handle , property .getId (), value , false ));
834- return this ;
835- }
836-
837- /**
838- * Ignores case when matching results. Use the overload and pass
839- * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
840- */
841- public QueryBuilder <T > endsWith (Property <T > property , String value ) {
842- verifyHandle ();
843- checkCombineCondition (nativeEndsWith (handle , property .getId (), value , false ));
844- return this ;
845- }
846-
847- public QueryBuilder <T > contains (Property <T > property , String value , StringOrder order ) {
777+ void containsNoTypeCheck (Property <T > property , String value , StringOrder order ) {
848778 verifyHandle ();
849779 checkCombineCondition (nativeContains (handle , property .getId (), value , order == StringOrder .CASE_SENSITIVE ));
850- return this ;
851780 }
852781
853782 public QueryBuilder <T > startsWith (Property <T > property , String value , StringOrder order ) {
@@ -862,14 +791,6 @@ public QueryBuilder<T> endsWith(Property<T> property, String value, StringOrder
862791 return this ;
863792 }
864793
865- /**
866- * Ignores case when matching results. Use the overload and pass
867- * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
868- */
869- public QueryBuilder <T > less (Property <T > property , String value ) {
870- return less (property , value , StringOrder .CASE_INSENSITIVE );
871- }
872-
873794 public QueryBuilder <T > less (Property <T > property , String value , StringOrder order ) {
874795 verifyHandle ();
875796 checkCombineCondition (nativeLess (handle , property .getId (), value , order == StringOrder .CASE_SENSITIVE , false ));
@@ -882,14 +803,6 @@ public QueryBuilder<T> lessOrEqual(Property<T> property, String value, StringOrd
882803 return this ;
883804 }
884805
885- /**
886- * Ignores case when matching results. Use the overload and pass
887- * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
888- */
889- public QueryBuilder <T > greater (Property <T > property , String value ) {
890- return greater (property , value , StringOrder .CASE_INSENSITIVE );
891- }
892-
893806 public QueryBuilder <T > greater (Property <T > property , String value , StringOrder order ) {
894807 verifyHandle ();
895808 checkCombineCondition (nativeGreater (handle , property .getId (), value , order == StringOrder .CASE_SENSITIVE , false ));
@@ -902,14 +815,6 @@ public QueryBuilder<T> greaterOrEqual(Property<T> property, String value, String
902815 return this ;
903816 }
904817
905- /**
906- * Ignores case when matching results. Use the overload and pass
907- * {@link StringOrder#CASE_SENSITIVE StringOrder.CASE_SENSITIVE} to specify that case should not be ignored.
908- */
909- public QueryBuilder <T > in (Property <T > property , String [] values ) {
910- return in (property , values , StringOrder .CASE_INSENSITIVE );
911- }
912-
913818 public QueryBuilder <T > in (Property <T > property , String [] values , StringOrder order ) {
914819 verifyHandle ();
915820 checkCombineCondition (nativeIn (handle , property .getId (), values , order == StringOrder .CASE_SENSITIVE ));
0 commit comments