Record Class Subdivision
java.lang.Object
java.lang.Record
com.maxmind.geoip2.record.Subdivision
- Record Components:
locales- The locales to use for retrieving localized names.confidence- A value from 0-100 indicating MaxMind's confidence that the subdivision is correct. This attribute is only available from the Insights web service and the GeoIP2 Enterprise database.geonameId- The GeoName ID for the subdivision.isoCode- A string up to three characters long containing the subdivision portion of the ISO 3166-2 code.names- AMapfrom locale codes to the name in that locale.
- All Implemented Interfaces:
JsonSerializable, NamedRecord
public record Subdivision(List<String> locales, Integer confidence, Long geonameId, String isoCode, Map<String,String> names)
extends Record
implements NamedRecord
Contains data for the subdivisions associated with an IP address.
Do not use any of the subdivision names as a database or map key. Use the
value returned by geonameId() or isoCode() instead.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSubdivisionrecord.Subdivision(Subdivision subdivision, List<String> locales) Constructs an instance ofSubdivisionwith the specified parameters.Subdivision(List<String> locales, Integer confidence, Long geonameId, String isoCode, Map<String, String> names) Compact canonical constructor that ensures immutability and handles null values. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfidencerecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegeonameIdrecord component.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.UsegeonameId()instead.Deprecated, for removal: This API element is subject to removal in a future version.UseisoCode()instead.getName()Deprecated, for removal: This API element is subject to removal in a future version.UseNamedRecord.name()instead.getNames()Deprecated, for removal: This API element is subject to removal in a future version.Usenames()instead.final inthashCode()Returns a hash code value for this object.isoCode()Returns the value of theisoCoderecord component.locales()Returns the value of thelocalesrecord component.names()Returns the value of thenamesrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface JsonSerializable
toJsonMethods inherited from interface NamedRecord
name
-
Constructor Details
-
Subdivision
-
Subdivision
public Subdivision()Constructs aSubdivisionrecord. -
Subdivision
Constructs an instance ofSubdivisionwith the specified parameters.- Parameters:
subdivision- TheSubdivisionobject to copy.locales- The locales to use.
-
-
Method Details
-
getConfidence
Deprecated, for removal: This API element is subject to removal in a future version.Useconfidence()instead. This method will be removed in 6.0.0.- Returns:
- A value from 0-100 indicating MaxMind's confidence that the subdivision is correct. This attribute is only available from the Insights web service and the GeoIP2 Enterprise database.
-
getIsoCode
Deprecated, for removal: This API element is subject to removal in a future version.UseisoCode()instead. This method will be removed in 6.0.0.- Returns:
- A string up to three characters long containing the subdivision portion of the ISO 3166-2 code.
-
getGeoNameId
Deprecated, for removal: This API element is subject to removal in a future version.UsegeonameId()instead. This method will be removed in 6.0.0.- Returns:
- The GeoName ID for the subdivision.
-
getName
Deprecated, for removal: This API element is subject to removal in a future version.UseNamedRecord.name()instead. This method will be removed in 6.0.0.- Returns:
- The name of the subdivision based on the locales list.
-
getNames
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
locales
-
confidence
Returns the value of theconfidencerecord component.- Returns:
- the value of the
confidencerecord component
-
geonameId
Returns the value of thegeonameIdrecord component.- Specified by:
geonameIdin interfaceNamedRecord- Returns:
- the value of the
geonameIdrecord component
-
isoCode
-
names
-
confidence()instead.