Skip to content

Commit 6455e1c

Browse files
oschwaldclaude
andcommitted
Remove deprecated Location.getMetroCode() method
* Remove deprecated getMetroCode() method and associated field * Remove metroCode parameter from constructors and documentation * Metro code values are no longer maintained by MaxMind 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 152e3d6 commit 6455e1c

File tree

4 files changed

+3
-23
lines changed

4 files changed

+3
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ CHANGELOG
1717
* **BREAKING:** The deprecated `Traits` constructors and methods
1818
`isAnonymousProxy()` and `isSatelliteProvider()` have been removed. Use the
1919
GeoIP2 Anonymous IP database for anonymous proxy detection instead.
20+
* **BREAKING:** The deprecated `Location.getMetroCode()` method has been
21+
removed. Metro code values are no longer maintained.
2022

2123
4.4.0
2224
------------------

src/main/java/com/maxmind/geoip2/record/Location.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ public class Location extends AbstractRecord {
1515
private final Integer averageIncome;
1616
private final Double latitude;
1717
private final Double longitude;
18-
private final Integer metroCode;
1918
private final Integer populationDensity;
2019
private final String timeZone;
2120

2221
/**
2322
* Constructs a {@code Location} record with {@code null} values for all the fields.
2423
*/
2524
public Location() {
26-
this(null, null, null, null, null, null, null);
25+
this(null, null, null, null, null, null);
2726
}
2827

2928
/**
@@ -43,10 +42,6 @@ public Location() {
4342
* @param longitude The approximate longitude of the location associated
4443
* with the IP address. This value is not precise and should not be used
4544
* to identify a particular address or household.
46-
* @param metroCode The metro code of the location if the location is in
47-
* the US. MaxMind returns the same metro codes as the <a href=
48-
* "https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions"
49-
* >Google AdWords API</a>.
5045
* @param populationDensity The estimated population per square kilometer
5146
* associated with the IP address. This attribute is only available from
5247
* the Insights web service.
@@ -62,7 +57,6 @@ public Location(
6257
Integer averageIncome,
6358
@JsonProperty("latitude") @MaxMindDbParameter(name = "latitude") Double latitude,
6459
@JsonProperty("longitude") @MaxMindDbParameter(name = "longitude") Double longitude,
65-
@JsonProperty("metro_code") @MaxMindDbParameter(name = "metro_code") Integer metroCode,
6660
@JsonProperty("population_density") @MaxMindDbParameter(name = "population_density")
6761
Integer populationDensity,
6862
@JsonProperty("time_zone") @MaxMindDbParameter(name = "time_zone") String timeZone
@@ -71,7 +65,6 @@ public Location(
7165
this.averageIncome = averageIncome;
7266
this.latitude = latitude;
7367
this.longitude = longitude;
74-
this.metroCode = metroCode;
7568
this.populationDensity = populationDensity;
7669
this.timeZone = timeZone;
7770
}
@@ -118,16 +111,6 @@ public Integer getAccuracyRadius() {
118111
return this.accuracyRadius;
119112
}
120113

121-
/**
122-
* @return The metro code is a no-longer-maintained code for targeting
123-
* advertisements in Google.
124-
* @deprecated Code values are no longer maintained.
125-
*/
126-
@JsonProperty("metro_code")
127-
@Deprecated
128-
public Integer getMetroCode() {
129-
return this.metroCode;
130-
}
131114

132115
/**
133116
* @return The approximate latitude of the location associated with the

src/test/resources/test-data/insights0.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"average_income": 24626,
2727
"latitude": 44.98,
2828
"longitude": 93.2636,
29-
"metro_code": 765,
3029
"population_density": 1341,
3130
"time_zone": "America/Chicago"
3231
},
@@ -74,13 +73,11 @@
7473
"ip_address": "1.2.3.4",
7574
"isp": "Comcast",
7675
"is_anonymous": true,
77-
"is_anonymous_proxy": true,
7876
"is_anonymous_vpn": true,
7977
"is_anycast": true,
8078
"is_hosting_provider": true,
8179
"is_public_proxy": true,
8280
"is_residential_proxy": true,
83-
"is_satellite_provider": true,
8481
"is_tor_exit_node": true,
8582
"organization": "Blorg",
8683
"static_ip_score": 1.3,

src/test/resources/test-data/insights1.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@
9090
"ip_address": "1.2.3.4",
9191
"isp": "Comcast",
9292
"is_anonymous": true,
93-
"is_anonymous_proxy": true,
9493
"is_anonymous_vpn": true,
9594
"is_anycast": true,
9695
"is_hosting_provider": true,
9796
"is_public_proxy": true,
98-
"is_satellite_provider": true,
9997
"is_tor_exit_node": true,
10098
"organization": "Blorg",
10199
"static_ip_score": 1.3,

0 commit comments

Comments
 (0)