Add expression in. (#171)

* Add expression in.

* Add test for expression in.
This commit is contained in:
Kevin Li
2020-02-19 08:52:39 +08:00
committed by GitHub
parent 6109d74b8a
commit 18264df98d
5 changed files with 97 additions and 0 deletions

View File

@@ -1536,6 +1536,42 @@ public class Expression {
return at(literal(number), expression);
}
/**
* Retrieves whether an item exists in an array or a substring exists in a string.
*
* @param needle the item expression
* @param haystack the array or string expression
* @return true if exists.
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-in">Style specification</a>
*/
public static Expression in(@NonNull Expression needle, @NonNull Expression haystack) {
return new Expression("in", needle, haystack);
}
/**
* Retrieves whether an item exists in an array or a substring exists in a string.
*
* @param needle the item expression
* @param haystack the array or string expression
* @return true if exists.
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-in">Style specification</a>
*/
public static Expression in(@NonNull Number needle, @NonNull Expression haystack) {
return new Expression("in", literal(needle), haystack);
}
/**
* Retrieves whether an item exists in an array or a substring exists in a string.
*
* @param needle the item expression
* @param haystack the array or string expression
* @return true if exists.
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-in">Style specification</a>
*/
public static Expression in(@NonNull String needle, @NonNull Expression haystack) {
return new Expression("in", literal(needle), haystack);
}
/**
* Retrieves a property value from the current feature's properties,
* or from another object if a second argument is provided.