Package dev.reuss.tmdb.value.region
Record Class Region
java.lang.Object
java.lang.Record
dev.reuss.tmdb.value.region.Region
- Record Components:
value- the ISO 3166-1 alpha-2 region code
- All Implemented Interfaces:
TmdbModel,Serializable
Represents a TMDB region parameter.
TMDB expects regions as ISO 3166-1 alpha-2 country codes,
for example DE, US, GB or BR.
The region parameter is used by TMDB as a regional filter or presentation hint, for example for release dates, watch providers and discover/search requests.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static RegionCreates a region from a string value.toString()Returns the normalized ISO 3166-1 alpha-2 region code.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Region
Creates a new region.The value is normalized to uppercase.
- Throws:
IllegalArgumentException- ifvalueisnull, blank, empty, not a two-letter code or not known as an ISO 3166-1 alpha-2 country code
-
-
Method Details
-
of
Creates a region from a string value.- Parameters:
value- the ISO 3166-1 alpha-2 region code- Returns:
- a new region
- Throws:
IllegalArgumentException- ifvalueis invalid
-
toString
Returns the normalized ISO 3166-1 alpha-2 region code. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-