File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
src/main/java/io/ipgeolocation/api Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 11package io .ipgeolocation .api ;
22
3- import java .util .Map ;
3+ import java .util .Objects ;
4+ import org .json .JSONObject ;
45
56public class GeolocationCurrency {
67 private final String name ;
78 private final String code ;
89 private final String symbol ;
10+ private final JSONObject json ;
911
10- GeolocationCurrency (Map <String , Object > json ) {
11- this .name = (String ) json .get ("name" );
12- this .code = (String ) json .get ("code" );
13- this .symbol = (String ) json .get ("symbol" );
12+ GeolocationCurrency (JSONObject json ) {
13+ if (Objects .isNull (json )) {
14+ throw new IllegalArgumentException ("'json' must not be null" );
15+ }
16+
17+ if (json .isEmpty ()) {
18+ throw new IllegalArgumentException ("'json' must not be empty" );
19+ }
20+
21+ this .name = json .getString ("name" );
22+ this .code = json .getString ("code" );
23+ this .symbol = json .getString ("symbol" );
24+ this .json = json ;
1425 }
1526
1627 public String getName () {
@@ -24,4 +35,9 @@ public String getCode() {
2435 public String getSymbol () {
2536 return symbol ;
2637 }
38+
39+ @ Override
40+ public String toString () {
41+ return json .toString (2 );
42+ }
2743}
You can’t perform that action at this time.
0 commit comments