Record Class Address

java.lang.Object
java.lang.Record
energy.eddie.regionconnector.es.datadis.dtos.Address

public record Address(@Nullable String street, @Nullable String buildingNumber, @Nullable String floor, @Nullable String door, @Nullable String postalCode, @Nullable String city, @Nullable String province) extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    Address(String street, String buildingNumber, String floor, String door, String postalCode, String city, String province)
    Creates an instance of a Address record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the buildingNumber record component.
    Returns the value of the city record component.
    Returns the value of the door record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the floor record component.
    final int
    Returns a hash code value for this object.
    parse(String addressString)
    Parsing an address string based on: "Street, Number , [FloorºDoor] PostalCode-City - Province" If the address string does not match the expected format, an empty optional is returned.
    Returns the value of the postalCode record component.
    Returns the value of the province record component.
    Returns the value of the street record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Address

      public Address(@Nullable String street, @Nullable String buildingNumber, @Nullable String floor, @Nullable String door, @Nullable String postalCode, @Nullable String city, @Nullable String province)
      Creates an instance of a Address record class.
      Parameters:
      street - the value for the street record component
      buildingNumber - the value for the buildingNumber record component
      floor - the value for the floor record component
      door - the value for the door record component
      postalCode - the value for the postalCode record component
      city - the value for the city record component
      province - the value for the province record component
  • Method Details

    • parse

      public static Optional<Address> parse(String addressString)
      Parsing an address string based on: "Street, Number , [FloorºDoor] PostalCode-City - Province" If the address string does not match the expected format, an empty optional is returned.
      Parameters:
      addressString - a spanish address string
      Returns:
      an optional address object
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • street

      @Nullable public String street()
      Returns the value of the street record component.
      Returns:
      the value of the street record component
    • buildingNumber

      @Nullable public String buildingNumber()
      Returns the value of the buildingNumber record component.
      Returns:
      the value of the buildingNumber record component
    • floor

      @Nullable public String floor()
      Returns the value of the floor record component.
      Returns:
      the value of the floor record component
    • door

      @Nullable public String door()
      Returns the value of the door record component.
      Returns:
      the value of the door record component
    • postalCode

      @Nullable public String postalCode()
      Returns the value of the postalCode record component.
      Returns:
      the value of the postalCode record component
    • city

      @Nullable public String city()
      Returns the value of the city record component.
      Returns:
      the value of the city record component
    • province

      @Nullable public String province()
      Returns the value of the province record component.
      Returns:
      the value of the province record component