blob: aed392876bd33d7afe9c279dd51bacafca75c270 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
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, Exception exception) {
if (strictModeEnabled) {
throw new MapStrictModeException(String.format("%s - %s", message, exception));
}
}
/**
* Internal use. Called whenever the strict mode violation occurs.
*/
public static void strictModeViolation(String message, Error error) {
if (strictModeEnabled) {
throw new MapStrictModeException(String.format("%s - %s", message, error));
}
}
/**
* Internal use. Called whenever the strict mode violation occurs.
*/
public static void strictModeViolation(Error error) {
if (strictModeEnabled) {
throw new MapStrictModeException(String.format("%s", error));
}
}
/**
* Internal use. Called whenever the strict mode violation occurs.
*/
public static void strictModeViolation(Exception exception) {
if (strictModeEnabled) {
throw new MapStrictModeException(String.format("%s", exception));
}
}
}
|