* To create new instances of this object, create a new instance using a {@link Builder} and load the style with
* MapboxMap. This object is returned from {@link MapboxMap#getStyle()} once the style
* has been loaded by underlying map.
*
*/
@SuppressWarnings("unchecked")
public class Style {
static final String EMPTY_JSON = "{\"version\": 8,\"sources\": {},\"layers\": []}";
private final NativeMap nativeMap;
private final HashMap sources = new HashMap<>();
private final HashMap layers = new HashMap<>();
private final HashMap images = new HashMap<>();
private final Builder builder;
private boolean fullyLoaded;
/**
* Private constructor to build a style object.
*
* @param builder the builder used for creating this style
* @param nativeMap the map object used to load this style
*/
private Style(@NonNull Builder builder, @NonNull NativeMap nativeMap) {
this.builder = builder;
this.nativeMap = nativeMap;
}
/**
* Returns the current style url.
*
* @return the style url
* @deprecated use {@link #getUri()} instead
*/
@NonNull
@Deprecated
public String getUrl() {
validateState("getUrl");
return nativeMap.getStyleUri();
}
/**
* Returns the current style uri.
*
* @return the style uri
*/
@NonNull
public String getUri() {
validateState("getUri");
return nativeMap.getStyleUri();
}
/**
* Returns the current style json.
*
* @return the style json
*/
@NonNull
public String getJson() {
validateState("getJson");
return nativeMap.getStyleJson();
}
//
// Source
//
/**
* Retrieve all the sources in the style
*
* @return all the sources in the current style
*/
@NonNull
public List