summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-03-22 18:41:30 -0400
committerTobrun <tobrun.van.nuland@gmail.com>2018-03-22 18:41:30 -0400
commit5814ac70f7d2499ce253a300b50e93d36c52c5a6 (patch)
tree5f5bb6414218cc5fade012c61687d3f5310b0edb
parent61e6e626638144607c5dd7766a854b3ffa232e00 (diff)
downloadqtlocation-mapboxgl-upstream/tvn-convenience-expressions.tar.gz
[android] - add convenience methods for string, number, objectupstream/tvn-convenience-expressions
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java
index dee8b043b8..4509919992 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java
@@ -1362,6 +1362,19 @@ public class Expression {
}
/**
+ * Asserts that the input value is a string.
+ * If multiple values are provided, each one is evaluated in order until a string value is obtained.
+ * If none of the inputs are strings, the expression is an error.
+ *
+ * @param input expression input
+ * @return expression
+ * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-string">Style specification</a>
+ */
+ public static Expression string(@NonNull String input) {
+ return string(literal(input));
+ }
+
+ /**
* Asserts that the input value is a number.
* If multiple values are provided, each one is evaluated in order until a number value is obtained.
* If none of the inputs are numbers, the expression is an error.
@@ -1375,6 +1388,19 @@ public class Expression {
}
/**
+ * Asserts that the input value is a number.
+ * If multiple values are provided, each one is evaluated in order until a number value is obtained.
+ * If none of the inputs are numbers, the expression is an error.
+ *
+ * @param input expression input
+ * @return expression
+ * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-number">Style specification</a>
+ */
+ public static Expression number(@NonNull Number input) {
+ return number(literal(input));
+ }
+
+ /**
* Asserts that the input value is a boolean.
* If multiple values are provided, each one is evaluated in order until a boolean value is obtained.
* If none of the inputs are booleans, the expression is an error.
@@ -1388,6 +1414,19 @@ public class Expression {
}
/**
+ * Asserts that the input value is a boolean.
+ * If multiple values are provided, each one is evaluated in order until a boolean value is obtained.
+ * If none of the inputs are booleans, the expression is an error.
+ *
+ * @param input expression input
+ * @return expression
+ * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-boolean">Style specification</a>
+ */
+ public static Expression bool(@NonNull boolean input) {
+ return bool(literal(input));
+ }
+
+ /**
* Asserts that the input value is an object. If it is not, the expression is an error
*
* @param input expression input
@@ -1399,6 +1438,17 @@ public class Expression {
}
/**
+ * Asserts that the input value is an object. If it is not, the expression is an error
+ *
+ * @param input expression input
+ * @return expression
+ * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-object">Style specification</a>
+ */
+ public static Expression object(@NonNull Object input) {
+ return object(literal(input));
+ }
+
+ /**
* Converts the input value to a string.
* If the input is null, the result is null.
* If the input is a boolean, the result is true or false.