Package w.geo.api

Class ImmutableGeoLocation

java.lang.Object
w.geo.api.ImmutableGeoLocation
All Implemented Interfaces:
GeoLocation

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableGeoLocation extends Object implements GeoLocation
Immutable implementation of GeoLocation.

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

  • Method Details

    • getCity

      @Nullable public @Nullable String getCity()
      Specified by:
      getCity in interface GeoLocation
      Returns:
      The value of the city attribute
    • getCountry

      @Nullable public @Nullable Country getCountry()
      Specified by:
      getCountry in interface GeoLocation
      Returns:
      The value of the country attribute
    • withCity

      public final ImmutableGeoLocation withCity(@Nullable @Nullable 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 (can be null)
      Returns:
      A modified copy of the this object
    • withCountry

      public final ImmutableGeoLocation withCountry(@Nullable @Nullable Country value)
      Copy the current immutable object by setting a value for the country attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for country (can be null)
      Returns:
      A modified copy of the this object
    • equals

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

      public int hashCode()
      Computes a hash code from attributes: city, country.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableGeoLocation copyOf(GeoLocation instance)
      Creates an immutable copy of a GeoLocation 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 GeoLocation instance
    • builder

      public static ImmutableGeoLocation.Builder builder()
      Creates a builder for ImmutableGeoLocation.
       ImmutableGeoLocation.builder()
          .city(String | null) // nullable city
          .country(w.geo.api.Country | null) // nullable country
          .build();
       
      Returns:
      A new ImmutableGeoLocation builder