Package com.cta4j.train.station.model
Record Class Location
java.lang.Object
java.lang.Record
com.cta4j.train.station.model.Location
- Record Components:
latitude- the latitudelongitude- the longitudehumanAddress- the human-readable address, ornullif not available
@NullMarked
public record Location(BigDecimal latitude, BigDecimal longitude, @Nullable HumanAddress humanAddress)
extends Record
Represents a geographical location with latitude and longitude, optionally including a human-readable address.
-
Constructor Summary
ConstructorsConstructorDescriptionLocation(BigDecimal latitude, BigDecimal longitude, @Nullable HumanAddress humanAddress) Constructs aLocation. -
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.@Nullable HumanAddressReturns the value of thehumanAddressrecord component.latitude()Returns the value of thelatituderecord component.Returns the value of thelongituderecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Location
Constructs aLocation.- Parameters:
latitude- the latitudelongitude- the longitudehumanAddress- the human-readable address, ornullif not available- Throws:
NullPointerException- iflatitudeorlongitudeisnull
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
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). -
latitude
Returns the value of thelatituderecord component.- Returns:
- the value of the
latituderecord component
-
longitude
Returns the value of thelongituderecord component.- Returns:
- the value of the
longituderecord component
-
humanAddress
Returns the value of thehumanAddressrecord component.- Returns:
- the value of the
humanAddressrecord component
-