Skip to content

Commit 31d0fa7

Browse files
committed
Explicitly deprecate some constructors
1 parent 40cf556 commit 31d0fa7

File tree

9 files changed

+55
-16
lines changed

9 files changed

+55
-16
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
CHANGELOG
22
=========
33

4+
2.16.0
5+
-------------------
6+
7+
* Deprecated model constructors that exist for backwards compatibility.
8+
These constructors are not generally used by users of this library
9+
directly except perhaps when mocking the reader in tests.
10+
411
2.15.0 (2020-10-14)
512
-------------------
613

src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ public class AnonymousIpResponse extends AbstractResponse {
2828
this(null, false, false, false, false, false);
2929
}
3030

31-
// This is for compatibility and should be removed if we do a major release.
32-
public AnonymousIpResponse(
31+
/**
32+
* @deprecated This constructor exists for backwards compatibility. Will be
33+
* removed in the next major release.
34+
*/ public AnonymousIpResponse(
3335
String ipAddress,
3436
boolean isAnonymous,
3537
boolean isAnonymousVpn,
@@ -40,8 +42,10 @@ public AnonymousIpResponse(
4042
this(ipAddress, isAnonymous, isAnonymousVpn, isHostingProvider, isPublicProxy, isTorExitNode, null);
4143
}
4244

43-
// This is for compatibility and should be removed if we do a major release.
44-
public AnonymousIpResponse(
45+
/**
46+
* @deprecated This constructor exists for backwards compatibility. Will be
47+
* removed in the next major release.
48+
*/ public AnonymousIpResponse(
4549
String ipAddress,
4650
boolean isAnonymous,
4751
boolean isAnonymousVpn,

src/main/java/com/maxmind/geoip2/model/AsnResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public class AsnResponse extends AbstractResponse {
2424
this((Integer) null, null, null, null);
2525
}
2626

27+
/**
28+
* @deprecated This constructor exists for backwards compatibility. Will be
29+
* removed in the next major release.
30+
*/
2731
public AsnResponse(
2832
Integer autonomousSystemNumber,
2933
String autonomousSystemOrganization,

src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public static ConnectionType fromString(String s) {
6868
this(null, null);
6969
}
7070

71+
/**
72+
* @deprecated This constructor exists for backwards compatibility. Will be
73+
* removed in the next major release.
74+
*/
7175
public ConnectionTypeResponse(
7276
ConnectionType connectionType,
7377
String ipAddress

src/main/java/com/maxmind/geoip2/model/DomainResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public class DomainResponse extends AbstractResponse {
2323
this(null, null);
2424
}
2525

26+
/**
27+
* @deprecated This constructor exists for backwards compatibility. Will be
28+
* removed in the next major release.
29+
*/
2630
public DomainResponse(
2731
String domain,
2832
String ipAddress

src/main/java/com/maxmind/geoip2/model/IspResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public class IspResponse extends AsnResponse {
2020
this(null, null, null, null, null);
2121
}
2222

23+
/**
24+
* @deprecated This constructor exists for backwards compatibility. Will be
25+
* removed in the next major release.
26+
*/
2327
public IspResponse(
2428
Integer autonomousSystemNumber,
2529
String autonomousSystemOrganization,

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ public Country() {
3030
this(null, null, (Integer) null, false, null, null);
3131
}
3232

33-
// This method is for backwards compatibility. We should remove it when we
34-
// do a major release.
33+
/**
34+
* @deprecated This constructor exists for backwards compatibility. Will be
35+
* removed in the next major release.
36+
*/
3537
public Country(
3638
List<String> locales,
3739
Integer confidence,

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ public RepresentedCountry() {
3030
this(null, null, (Integer) null, false, null, null, null);
3131
}
3232

33-
// This method is for backwards compatibility. We should remove it when we
34-
// do a major release.
33+
/**
34+
* @deprecated This constructor exists for backwards compatibility. Will be
35+
* removed in the next major release.
36+
*/
3537
public RepresentedCountry(
3638
List<String> locales,
3739
Integer confidence,

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ public Traits(String ipAddress, Network network) {
5757
network, null, null, null, null);
5858
}
5959

60-
// This is for back-compat. If we ever do a major release, it should be
61-
// removed.
60+
/**
61+
* @deprecated This constructor exists for backwards compatibility. Will be
62+
* removed in the next major release.
63+
*/
6264
public Traits(
6365
Integer autonomousSystemNumber,
6466
String autonomousSystemOrganization,
@@ -75,8 +77,10 @@ public Traits(
7577
organization, userType);
7678
}
7779

78-
// This is for back-compat. If we ever do a major release, it should be
79-
// removed.
80+
/**
81+
* @deprecated This constructor exists for backwards compatibility. Will be
82+
* removed in the next major release.
83+
*/
8084
public Traits(
8185
Integer autonomousSystemNumber,
8286
String autonomousSystemOrganization,
@@ -95,8 +99,10 @@ public Traits(
9599
false, isSatelliteProvider, false, isp, null, organization, userType, null, null);
96100
}
97101

98-
// This is for back-compat. If we ever do a major release, it should be
99-
// removed.
102+
/**
103+
* @deprecated This constructor exists for backwards compatibility. Will be
104+
* removed in the next major release.
105+
*/
100106
public Traits(
101107
Integer autonomousSystemNumber,
102108
String autonomousSystemOrganization,
@@ -121,8 +127,10 @@ public Traits(
121127
null, organization, userType, null, null);
122128
}
123129

124-
// This is for back-compat. If we ever do a major release, it should be
125-
// removed.
130+
/**
131+
* @deprecated This constructor exists for backwards compatibility. Will be
132+
* removed in the next major release.
133+
*/
126134
public Traits(
127135
Integer autonomousSystemNumber,
128136
String autonomousSystemOrganization,

0 commit comments

Comments
 (0)