I'm building a Jsinteropted wrapper for Mapbox-gl-js's source objects.
I've an abstract class Source
which embed default methods like getting/setting the type of the source.
@JsType(isNative = true, namespace = GLOBAL, name = JS_OBJECT_NAME)
public class Source {
@JsProperty
protected final native String getType();
@JsProperty
protected final native void setType(String type);
}
And I've some inherited class which must (according to Mapbbox documentation) define the type
property! So I would like to do something like:
@JsType(isNative = true, namespace = GLOBAL, name = JS_OBJECT_NAME)
public class GeoJsonSource extends Source {
@JsConstructor
public GeoJson() {
setType("geojson");
}
}
or
@JsType(isNative = true, namespace = GLOBAL, name = JS_OBJECT_NAME)
public class GeoJsonSource extends Source {
@JsProperty
private String type = "geojson";
}
But both are forbidden by GWT compiler.
For now I use a factory which create the GeoJsonSource and then put the right type
property, but I wonder if there is a Jsinteropt way to do it?