-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will the ability to set custom properties with PropertyValue come back? #46
Comments
Thank you for reaching out @VincentJoshuaET, the SDK between v9.0.0 and v10.0.0 has been rebuild from the ground up. Instead of using PropertyValue, we use There might be a way to provide conversion from one to another with using the HashMap setup but it would require some boiler plate to get it to work. Thanks again for reaching out and using our products! **
* Wrapper class for value, complies to the mapbox type system.
*/
public class Value {
@Nullable
private Object contents;
/**
* Create a value from an object.
*
* @param obj object to wrap
*/
private Value(@Nullable Object obj) {
this.contents = obj;
}
/**
* Create a value from a double.
*
* @param d double to wrap
*/
public Value(double d) {
this.contents = Double.valueOf(d);
}
/**
* Create a value from a long.
*
* @param l long to wrap
*/
public Value(long l) {
this.contents = Long.valueOf(l);
}
/**
* Create a value from a boolean.
*
* @param b boolean to wrap
*/
public Value(boolean b) {
this.contents = Boolean.valueOf(b);
}
/**
* Create a value from a string.
*
* @param str string to wrap
*/
public Value(@NonNull String str) {
this.contents = str;
}
/**
* Create a value from an list.
*
* @param array list to wrap
*/
public Value(@NonNull List<Value> array) {
this.contents = array;
}
/**
* Create a value from a map.
*
* @param map map to wrap
*/
public Value(@NonNull HashMap<String, Value> map) {
this.contents = map;
}
/**
* Create a value from a double.
*
* @param d the double to create a value from
* @return the created value
*/
@NonNull
public static Value valueOf(double d) {
return new Value(Double.valueOf(d));
}
/**
* Create a value from a long.
*
* @param l the long to create a value from
* @return the created value
*/
@NonNull
public static Value valueOf(long l) {
return new Value(Long.valueOf(l));
}
/**
* Create a value from a boolean.
*
* @param b the boolean to create a value from
* @return the created value
*/
@NonNull
public static Value valueOf(boolean b) {
return new Value(Boolean.valueOf(b));
}
/**
* Create a value from a string.
*
* @param str the string to create a value from
* @return the created value
*/
@NonNull
public static Value valueOf(@NonNull String str) {
return new Value(str);
}
/**
* Create a value from an list
*
* @param array the list to create a value from
* @return the created value
*/
@NonNull
public static Value valueOf(@NonNull List<Value> array) {
return new Value(array);
}
/**
* Create a value from a map
*
* @param map the map to create a value from
* @return the created value
*/
@NonNull
public static Value valueOf(@NonNull HashMap<String, Value> map) {
return new Value(map);
}
/**
* Get the contents of the value
*
* @return the wrapped value
*/
@Nullable
public Object getContents() {
return this.contents;
}
@Override
public String toString() {
return this.contents == null ? "" : this.contents.toString();
}
@Override
public int hashCode() {
return contents == null ? 0 : contents.hashCode();
}
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (other instanceof Value) {
if (this.contents == null && ((Value) other).contents == null) {
return true;
}
if (this.contents == null) {
return false;
}
if (((Value) other).contents == null){
return false;
}
Class<?> thisClass = this.contents.getClass();
Class<?> otherClass = ((Value) other).contents.getClass();
if (thisClass.isAssignableFrom(otherClass)) {
return this.contents.equals(((Value) other).contents);
}
}
return this.contents.equals(other);
}
} |
Okay but as far as I know we now are not able to set these custom Values to the layers. |
There is a division in what we internally call the high and low level style API. The high level is what you see under the style extensions: The low level is what is available on the StyleManager interface and uses the Value API directly: |
layer.setProperties(PropertyValue(key, value))
We have a database that contains these properties.
The text was updated successfully, but these errors were encountered: