Class ImmutableAddress

  • All Implemented Interfaces:
    com.arakelian.store.feature.HasId, com.arakelian.store.feature.HasTimestamp, java.io.Serializable, java.lang.Comparable<com.arakelian.store.feature.HasId>

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableAddress
    extends Address
    Immutable implementation of Address.

    Use the builder to create immutable instances: ImmutableAddress.builder().

    See Also:
    Serialized Form
    • Method Detail

      • getCreated

        public java.time.ZonedDateTime getCreated()
        Specified by:
        getCreated in interface com.arakelian.store.feature.HasTimestamp
        Overrides:
        getCreated in class AbstractModel
        Returns:
        The value of the created attribute
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface com.arakelian.store.feature.HasId
        Overrides:
        getId in class AbstractModel
        Returns:
        The value of the id attribute
      • getUpdated

        public java.time.ZonedDateTime getUpdated()
        Specified by:
        getUpdated in interface com.arakelian.store.feature.HasTimestamp
        Overrides:
        getUpdated in class AbstractModel
        Returns:
        The value of the updated attribute
      • getCity

        public java.lang.String getCity()
        Specified by:
        getCity in class Address
        Returns:
        The value of the city attribute
      • getPostalCode

        public java.lang.String getPostalCode()
        Specified by:
        getPostalCode in class Address
        Returns:
        The value of the postalCode attribute
      • getState

        public java.lang.String getState()
        Specified by:
        getState in class Address
        Returns:
        The value of the state attribute
      • getStreet

        public java.lang.String getStreet()
        Specified by:
        getStreet in class Address
        Returns:
        The value of the street attribute
      • withCreated

        public final ImmutableAddress withCreated​(java.time.ZonedDateTime value)
        Copy the current immutable object by setting a value for the created attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for created
        Returns:
        A modified copy of the this object
      • withId

        public final ImmutableAddress withId​(java.lang.String value)
        Copy the current immutable object by setting a value for the id attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for id
        Returns:
        A modified copy of the this object
      • withUpdated

        public final ImmutableAddress withUpdated​(java.time.ZonedDateTime value)
        Copy the current immutable object by setting a value for the updated attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for updated
        Returns:
        A modified copy of the this object
      • withCity

        public final ImmutableAddress withCity​(java.lang.String value)
        Copy the current immutable object by setting a value for the city attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for city
        Returns:
        A modified copy of the this object
      • withPostalCode

        public final ImmutableAddress withPostalCode​(java.lang.String value)
        Copy the current immutable object by setting a value for the postalCode attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for postalCode
        Returns:
        A modified copy of the this object
      • withState

        public final ImmutableAddress withState​(java.lang.String value)
        Copy the current immutable object by setting a value for the state attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for state
        Returns:
        A modified copy of the this object
      • withStreet

        public final ImmutableAddress withStreet​(java.lang.String value)
        Copy the current immutable object by setting a value for the street attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for street
        Returns:
        A modified copy of the this object
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object another)
        This instance is equal to all instances of ImmutableAddress that have equal attribute values.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: created, id, updated, city, postalCode, state, street.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value Address with attribute values.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the value
      • copyOf

        public static ImmutableAddress copyOf​(Address instance)
        Creates an immutable copy of a Address value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable Address instance
      • builder

        public static ImmutableAddress.Builder builder()
        Creates a builder for ImmutableAddress.
         ImmutableAddress.builder()
            .created(java.time.ZonedDateTime) // optional created
            .id(String) // optional id
            .updated(java.time.ZonedDateTime) // optional updated
            .city(String) // required city
            .postalCode(String) // required postalCode
            .state(String) // required state
            .street(String) // required street
            .build();
         
        Returns:
        A new ImmutableAddress builder