-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathDomainResponse.java
More file actions
72 lines (65 loc) · 2.53 KB
/
DomainResponse.java
File metadata and controls
72 lines (65 loc) · 2.53 KB
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
65
66
67
68
69
70
71
72
package com.maxmind.geoip2.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import tools.jackson.databind.annotation.JsonDeserialize;
import tools.jackson.databind.annotation.JsonSerialize;
import tools.jackson.databind.ser.std.ToStringSerializer;
import com.maxmind.db.MaxMindDbIpAddress;
import com.maxmind.db.MaxMindDbNetwork;
import com.maxmind.db.MaxMindDbParameter;
import com.maxmind.db.Network;
import com.maxmind.geoip2.JsonSerializable;
import com.maxmind.geoip2.NetworkDeserializer;
import java.net.InetAddress;
/**
* This class provides the GeoIP2 Domain model.
*
* @param domain The second level domain associated with the IP address. This will be something
* like "example.com" or "example.co.uk", not "foo.example.com".
* @param ipAddress The IP address that the data in the model is for.
* @param network The network associated with the record. In particular, this is the largest
* network where all the fields besides IP address have the same value.
*/
public record DomainResponse(
@JsonProperty("domain")
@MaxMindDbParameter(name = "domain")
String domain,
@JsonProperty("ip_address")
@MaxMindDbIpAddress
InetAddress ipAddress,
@JsonProperty("network")
@JsonDeserialize(using = NetworkDeserializer.class)
@MaxMindDbNetwork
Network network
) implements JsonSerializable {
/**
* @return The second level domain associated with the IP address. This
* will be something like "example.com" or "example.co.uk", not
* "foo.example.com".
* @deprecated Use {@link #domain()} instead. This method will be removed in 6.0.0.
*/
@Deprecated(since = "5.0.0", forRemoval = true)
public String getDomain() {
return domain();
}
/**
* @return The IP address that the data in the model is for.
* @deprecated Use {@link #ipAddress()} instead. This method will be removed in 6.0.0.
*/
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty("ip_address")
public String getIpAddress() {
return ipAddress().getHostAddress();
}
/**
* @return The network associated with the record. In particular, this is
* the largest network where all the fields besides IP address have the
* same value.
* @deprecated Use {@link #network()} instead. This method will be removed in 6.0.0.
*/
@Deprecated(since = "5.0.0", forRemoval = true)
@JsonProperty
@JsonSerialize(using = ToStringSerializer.class)
public Network getNetwork() {
return network();
}
}