blob: c7f995964cb45dc8e411716fed48b59101eaaf76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package com.mapbox.mapboxsdk;
/**
* Using this class you can enable a strict mode that will throw the {@link MapStrictModeException}
* whenever the map would fail silently otherwise.
*/
public class MapStrictMode {
private static volatile boolean strictModeEnabled;
/**
* Set the strict mode that will throw the {@link MapStrictModeException}
* whenever the map would fail silently otherwise.
*
* @param strictModeEnabled true to enable the strict mode, false otherwise
*/
public static synchronized void setStrictModeEnabled(boolean strictModeEnabled) {
MapStrictMode.strictModeEnabled = strictModeEnabled;
}
/**
* Internal use. Called whenever the strict mode violation occurs.
*/
public static void strictModeViolation(String message) {
if (strictModeEnabled) {
throw new MapStrictModeException(message);
}
}
/**
* Internal use. Called whenever the strict mode violation occurs.
*/
public static void strictModeViolation(String message, Throwable throwable) {
if (strictModeEnabled) {
throw new MapStrictModeException(String.format("%s - %s", message, throwable));
}
}
/**
* Internal use. Called whenever the strict mode violation occurs.
*/
public static void strictModeViolation(Throwable throwable) {
if (strictModeEnabled) {
throw new MapStrictModeException(String.format("%s", throwable));
}
}
}
|