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().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableGeoLocation. -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableGeoLocation.Builderbuilder()Creates a builder forImmutableGeoLocation.static ImmutableGeoLocationcopyOf(GeoLocation instance) Creates an immutable copy of aGeoLocationvalue.booleanThis instance is equal to all instances ofImmutableGeoLocationthat have equal attribute values.@Nullable StringgetCity()@Nullable CountryinthashCode()Computes a hash code from attributes:city,country.toString()Prints the immutable valueGeoLocationwith attribute values.final ImmutableGeoLocationCopy the current immutable object by setting a value for thecityattribute.final ImmutableGeoLocationwithCountry(@Nullable Country value) Copy the current immutable object by setting a value for thecountryattribute.
-
Method Details
-
getCity
- Specified by:
getCityin interfaceGeoLocation- Returns:
- The value of the
cityattribute
-
getCountry
- Specified by:
getCountryin interfaceGeoLocation- Returns:
- The value of the
countryattribute
-
withCity
Copy the current immutable object by setting a value for thecityattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for city (can benull)- Returns:
- A modified copy of the
thisobject
-
withCountry
Copy the current immutable object by setting a value for thecountryattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for country (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofImmutableGeoLocationthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:city,country. -
toString
Prints the immutable valueGeoLocationwith attribute values. -
copyOf
Creates an immutable copy of aGeoLocationvalue. 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
Creates a builder forImmutableGeoLocation.ImmutableGeoLocation.builder() .city(String | null) // nullablecity.country(w.geo.api.Country | null) // nullablecountry.build();- Returns:
- A new ImmutableGeoLocation builder
-