summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java
index a57c440df4..44f58a54c2 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java
@@ -5,6 +5,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.mapbox.mapboxsdk.exceptions.ConversionException;
+import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.functions.Function;
import com.mapbox.mapboxsdk.utils.ColorUtils;
@@ -57,6 +58,31 @@ public class PropertyValue<T> {
return !isNull() && !isFunction();
}
+ /**
+ * Returns if this is a expression.
+ *
+ * @return true if is a expression, false if not
+ */
+ public boolean isExpression() {
+ return !isNull() && value instanceof Expression;
+ }
+
+ /**
+ * Get the expression of the property.
+ *
+ * @return the expression value
+ */
+ @Nullable
+ public Expression<T> getExpression() {
+ if (isExpression()) {
+ // noinspection unchecked
+ return (Expression<T>) value;
+ } else {
+ Timber.e("not an expression, try value");
+ return null;
+ }
+ }
+
@Nullable
public Function<?, T> getFunction() {
if (isFunction()) {