Package dev.reuss.tmdb.value.language
Record Class LanguageCode
java.lang.Object
java.lang.Record
dev.reuss.tmdb.value.language.LanguageCode
- Record Components:
value- the two-letter ISO 639-1 language code
- All Implemented Interfaces:
TmdbModel,Serializable
Represents an ISO 639-1 language code.
TMDB uses ISO 639-1 language codes for localization,
for example de, en, pt, fr
or ja.
Language codes are usually combined with an ISO 3166-1 alpha-2
region code when sent to TMDB, for example de-DE,
en-US or pt-BR.
- 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 LanguageCodeCreates a language code from a string value.toString()Returns the normalized ISO 639-1 language code.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
LanguageCode
Creates a new ISO 639-1 language code.The value is normalized to lowercase.
- Throws:
IllegalArgumentException- ifvalueisnull, blank, empty, not a two-letter code or not known as an ISO 639-1 language code
-
-
Method Details
-
of
Creates a language code from a string value.- Parameters:
value- the ISO 639-1 language code- Returns:
- a new language code
- Throws:
IllegalArgumentException- ifvalueis invalid
-
toString
Returns the normalized ISO 639-1 language 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
-