Package com.cta4j.train.station.model
Record Class HumanAddress
java.lang.Object
java.lang.Record
com.cta4j.train.station.model.HumanAddress
- Record Components:
address- the street addresscity- the citystate- the statezip- the ZIP code
@NullMarked
public record HumanAddress(String address, String city, String state, String zip)
extends Record
Represents a human-readable address.
-
Constructor Summary
ConstructorsConstructorDescriptionHumanAddress(String address, String city, String state, String zip) Constructs aHumanAddress. -
Method Summary
Modifier and TypeMethodDescriptionaddress()Returns the value of theaddressrecord component.city()Returns the value of thecityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.state()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.zip()Returns the value of theziprecord component.
-
Constructor Details
-
HumanAddress
Constructs aHumanAddress.- Parameters:
address- the street addresscity- the citystate- the statezip- the ZIP code- Throws:
NullPointerException- ifaddress,city,state, orzipisnull
-
-
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). -
address
Returns the value of theaddressrecord component.- Returns:
- the value of the
addressrecord component
-
city
Returns the value of thecityrecord component.- Returns:
- the value of the
cityrecord component
-
state
Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-
zip
Returns the value of theziprecord component.- Returns:
- the value of the
ziprecord component
-