@@ -183,15 +183,15 @@ public String[] getAnalyticsTags() {
183
183
* Search for entries around a given latitude/longitude.
184
184
*
185
185
*/
186
- public @ NonNull Query setAroundLatLng (LatLng location ) {
186
+ public @ NonNull Query setAroundLatLng (@ Nullable LatLng location ) {
187
187
if (location == null ) {
188
188
return set (KEY_AROUND_LAT_LNG , null );
189
189
} else {
190
190
return set (KEY_AROUND_LAT_LNG , location .lat + "," + location .lng );
191
191
}
192
192
}
193
193
194
- public LatLng getAroundLatLng () {
194
+ public @ Nullable LatLng getAroundLatLng () {
195
195
return LatLng .parse (get (KEY_AROUND_LAT_LNG ));
196
196
}
197
197
@@ -363,7 +363,7 @@ public String[] getFacets() {
363
363
*
364
364
* @deprecated Use {@link Query#getFilters()} instead.
365
365
*/
366
- public JSONArray getFacetFilters () {
366
+ public @ Nullable JSONArray getFacetFilters () {
367
367
try {
368
368
String value = get (KEY_FACET_FILTERS );
369
369
if (value != null ) {
@@ -395,7 +395,7 @@ public JSONArray getFacetFilters() {
395
395
* Get the numeric, facet or/and tag filters for this Query.
396
396
* @return a String with this query's filters.
397
397
*/
398
- public String getFilters () {
398
+ public @ Nullable String getFilters () {
399
399
return get (KEY_FILTERS );
400
400
}
401
401
@@ -419,7 +419,7 @@ public Boolean getGetRankingInfo() {
419
419
return set (KEY_HIGHLIGHT_POST_TAG , tag );
420
420
}
421
421
422
- public String getHighlightPostTag () {
422
+ public @ Nullable String getHighlightPostTag () {
423
423
return get (KEY_HIGHLIGHT_POST_TAG );
424
424
}
425
425
@@ -429,7 +429,7 @@ public String getHighlightPostTag() {
429
429
return set (KEY_HIGHLIGHT_PRE_TAG , tag );
430
430
}
431
431
432
- public String getHighlightPreTag () {
432
+ public @ Nullable String getHighlightPreTag () {
433
433
return get (KEY_HIGHLIGHT_PRE_TAG );
434
434
}
435
435
@@ -457,7 +457,7 @@ public static final class IgnorePlurals {
457
457
public final boolean enabled ;
458
458
459
459
/** A list containing every active language's code. When {@code null}, all supported languages are be used. */
460
- public final List <String > languageCodes ;
460
+ public @ Nullable final List <String > languageCodes ;
461
461
462
462
/**
463
463
* Construct an IgnorePlurals object for a boolean value.
@@ -507,7 +507,7 @@ public String toString() {
507
507
}
508
508
}
509
509
510
- static @ NonNull IgnorePlurals parse (String s ) {
510
+ static @ NonNull IgnorePlurals parse (@ Nullable String s ) {
511
511
if (s == null || s .length () == 0 || s .equals ("null" )) {
512
512
return new IgnorePlurals (false );
513
513
} else if ("true" .equals (s ) || "false" .equals (s )) {
@@ -536,7 +536,7 @@ public String toString() {
536
536
}
537
537
538
538
@ Override
539
- public boolean equals (Object o ) {
539
+ public boolean equals (@ Nullable Object o ) {
540
540
if (this == o ) {
541
541
return true ;
542
542
}
@@ -601,7 +601,9 @@ Query setIgnorePlurals(@Nullable String... languageISOCodes) {
601
601
*/
602
602
public static final class GeoRect
603
603
{
604
+ @ NonNull
604
605
public final LatLng p1 ;
606
+ @ NonNull
605
607
public final LatLng p2 ;
606
608
607
609
public GeoRect (@ NonNull LatLng p1 , @ NonNull LatLng p2 ) {
@@ -610,7 +612,7 @@ public GeoRect(@NonNull LatLng p1, @NonNull LatLng p2) {
610
612
}
611
613
612
614
@ Override
613
- public boolean equals (Object other ) {
615
+ public boolean equals (@ Nullable Object other ) {
614
616
return other != null && other instanceof GeoRect
615
617
&& this .p1 .equals (((GeoRect )other ).p1 )
616
618
&& this .p2 .equals (((GeoRect )other ).p2 );
@@ -632,7 +634,7 @@ public int hashCode() {
632
634
*
633
635
* You can use several bounding boxes (OR) by calling this method several times.
634
636
*/
635
- public @ NonNull Query setInsideBoundingBox (GeoRect ... boxes ) {
637
+ public @ NonNull Query setInsideBoundingBox (@ Nullable GeoRect ... boxes ) {
636
638
if (boxes == null ) {
637
639
set (KEY_INSIDE_BOUNDING_BOX , null );
638
640
} else {
@@ -654,7 +656,7 @@ public int hashCode() {
654
656
return this ;
655
657
}
656
658
657
- public GeoRect [] getInsideBoundingBox () {
659
+ public @ Nullable GeoRect [] getInsideBoundingBox () {
658
660
try {
659
661
String value = get (KEY_INSIDE_BOUNDING_BOX );
660
662
if (value != null ) {
@@ -689,7 +691,7 @@ public GeoRect[] getInsideBoundingBox() {
689
691
* At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form "_geoloc":{"lat":48.853409, "lng":2.348800} or
690
692
* "_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}] if you have several geo-locations in your record).
691
693
*/
692
- public @ NonNull Query setInsidePolygon (LatLng ... points ) {
694
+ public @ NonNull Query setInsidePolygon (@ Nullable LatLng ... points ) {
693
695
if (points == null ) {
694
696
set (KEY_INSIDE_POLYGON , null );
695
697
} else if (points .length < 3 ) {
@@ -709,7 +711,7 @@ public GeoRect[] getInsideBoundingBox() {
709
711
return this ;
710
712
}
711
713
712
- public LatLng [] getInsidePolygon () {
714
+ public @ Nullable LatLng [] getInsidePolygon () {
713
715
try {
714
716
String value = get (KEY_INSIDE_POLYGON );
715
717
if (value != null ) {
@@ -803,11 +805,21 @@ public Integer getMinWordSizefor2Typos() {
803
805
804
806
private static final String KEY_NUMERIC_FILTERS = "numericFilters" ;
805
807
808
+ /**
809
+ * Set the <b>deprecated</b> {@code numericFilters} parameter.
810
+ *
811
+ * @deprecated Use {@link Query#setFilters(String)} instead.
812
+ */
806
813
public @ NonNull Query setNumericFilters (JSONArray filters ) {
807
814
return set (KEY_NUMERIC_FILTERS , filters );
808
815
}
809
816
810
- public JSONArray getNumericFilters () {
817
+ /**
818
+ * Get the value of <b>deprecated</b> {@code facetFilters} parameter.
819
+ *
820
+ * @deprecated Use {@link Query#getFilters()} instead.
821
+ */
822
+ public @ Nullable JSONArray getNumericFilters () {
811
823
try {
812
824
String value = get (KEY_NUMERIC_FILTERS );
813
825
if (value != null ) {
@@ -859,7 +871,7 @@ public Integer getPage() {
859
871
return set (KEY_QUERY , query );
860
872
}
861
873
862
- public String getQuery () {
874
+ public @ Nullable String getQuery () {
863
875
return get (KEY_QUERY );
864
876
}
865
877
@@ -868,7 +880,7 @@ public String getQuery() {
868
880
/**
869
881
* Select how the query words are interpreted:
870
882
*/
871
- public @ NonNull Query setQueryType (QueryType type ) {
883
+ public @ NonNull Query setQueryType (@ Nullable QueryType type ) {
872
884
if (type == null ) {
873
885
set (KEY_QUERY_TYPE , null );
874
886
} else {
@@ -887,7 +899,7 @@ public String getQuery() {
887
899
return this ;
888
900
}
889
901
890
- public QueryType getQueryType ()
902
+ public @ Nullable QueryType getQueryType ()
891
903
{
892
904
String value = get (KEY_QUERY_TYPE );
893
905
if (value != null ) {
@@ -919,7 +931,7 @@ public QueryType getQueryType()
919
931
throw new AlgoliaException ("removeStopWords should be a Boolean or a String." );
920
932
}
921
933
922
- public Object getRemoveStopWords () {
934
+ public @ Nullable Object getRemoveStopWords () {
923
935
final String value = get (KEY_REMOVE_STOP_WORDS );
924
936
if (value == null ) {
925
937
return null ;
@@ -936,7 +948,7 @@ public Object getRemoveStopWords() {
936
948
/**
937
949
* Select the strategy to adopt when a query does not return any result.
938
950
*/
939
- public @ NonNull Query setRemoveWordsIfNoResults (RemoveWordsIfNoResults type ) {
951
+ public @ NonNull Query setRemoveWordsIfNoResults (@ Nullable RemoveWordsIfNoResults type ) {
940
952
if (type == null ) {
941
953
set (KEY_REMOVE_WORDS_IF_NO_RESULT , null );
942
954
} else {
@@ -958,7 +970,7 @@ public Object getRemoveStopWords() {
958
970
return this ;
959
971
}
960
972
961
- public RemoveWordsIfNoResults getRemoveWordsIfNoResults ()
973
+ public @ Nullable RemoveWordsIfNoResults getRemoveWordsIfNoResults ()
962
974
{
963
975
String value = get (KEY_REMOVE_WORDS_IF_NO_RESULT );
964
976
if (value != null ) {
@@ -1021,7 +1033,7 @@ public String[] getRestrictSearchableAttributes()
1021
1033
return set (KEY_SNIPPET_ELLIPSIS_TEXT , snippetEllipsisText );
1022
1034
}
1023
1035
1024
- public String getSnippetEllipsisText () {
1036
+ public @ Nullable String getSnippetEllipsisText () {
1025
1037
return get (KEY_SNIPPET_ELLIPSIS_TEXT );
1026
1038
}
1027
1039
@@ -1046,7 +1058,7 @@ public Boolean getSynonyms() {
1046
1058
return set (KEY_TAG_FILTERS , tagFilters );
1047
1059
}
1048
1060
1049
- public JSONArray getTagFilters () {
1061
+ public @ Nullable JSONArray getTagFilters () {
1050
1062
try {
1051
1063
String value = get (KEY_TAG_FILTERS );
1052
1064
if (value != null ) {
@@ -1061,7 +1073,7 @@ public JSONArray getTagFilters() {
1061
1073
1062
1074
private static final String KEY_TYPO_TOLERANCE = "typoTolerance" ;
1063
1075
1064
- public @ NonNull Query setTypoTolerance (TypoTolerance type ) {
1076
+ public @ NonNull Query setTypoTolerance (@ Nullable TypoTolerance type ) {
1065
1077
if (type == null ) {
1066
1078
set (KEY_TYPO_TOLERANCE , null );
1067
1079
} else {
@@ -1083,7 +1095,7 @@ public JSONArray getTagFilters() {
1083
1095
return this ;
1084
1096
}
1085
1097
1086
- public TypoTolerance getTypoTolerance ()
1098
+ public @ Nullable TypoTolerance getTypoTolerance ()
1087
1099
{
1088
1100
String value = get (KEY_TYPO_TOLERANCE );
1089
1101
if (value != null ) {
@@ -1103,7 +1115,7 @@ public TypoTolerance getTypoTolerance()
1103
1115
1104
1116
private static final String KEY_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery" ;
1105
1117
1106
- public @ NonNull Query setExactOnSingleWordQuery (ExactOnSingleWordQuery type ) {
1118
+ public @ NonNull Query setExactOnSingleWordQuery (@ Nullable ExactOnSingleWordQuery type ) {
1107
1119
if (type == null ) {
1108
1120
set (KEY_EXACT_ON_SINGLE_WORD_QUERY , null );
1109
1121
} else {
@@ -1122,7 +1134,7 @@ public TypoTolerance getTypoTolerance()
1122
1134
return this ;
1123
1135
}
1124
1136
1125
- public ExactOnSingleWordQuery getExactOnSingleWordQuery ()
1137
+ public @ Nullable ExactOnSingleWordQuery getExactOnSingleWordQuery ()
1126
1138
{
1127
1139
String value = get (KEY_EXACT_ON_SINGLE_WORD_QUERY );
1128
1140
if (value != null ) {
@@ -1140,7 +1152,7 @@ public ExactOnSingleWordQuery getExactOnSingleWordQuery()
1140
1152
1141
1153
private static final String KEY_ALTERNATIVES_AS_EXACT = "alternativesAsExact" ;
1142
1154
1143
- public @ NonNull Query setAlternativesAsExact (AlternativesAsExact [] types ) {
1155
+ public @ NonNull Query setAlternativesAsExact (@ Nullable AlternativesAsExact [] types ) {
1144
1156
if (types == null ) {
1145
1157
set (KEY_ALTERNATIVES_AS_EXACT , null );
1146
1158
} else {
@@ -1164,7 +1176,7 @@ public ExactOnSingleWordQuery getExactOnSingleWordQuery()
1164
1176
return this ;
1165
1177
}
1166
1178
1167
- public AlternativesAsExact [] getAlternativesAsExact ()
1179
+ public @ Nullable AlternativesAsExact [] getAlternativesAsExact ()
1168
1180
{
1169
1181
String alternativesStr = get (KEY_ALTERNATIVES_AS_EXACT );
1170
1182
if (alternativesStr == null ) {
0 commit comments