Package com.cercalia.sdk.model.geocoding
Class GeocodingCandidate.Builder
java.lang.Object
com.cercalia.sdk.model.geocoding.GeocodingCandidate.Builder
- Enclosing class:
- GeocodingCandidate
Builder for constructing
GeocodingCandidate instances.
Provides a fluent API for setting all optional fields in a chainable manner.
Required fields (id, name, coord, type)
will be validated when build() is called.
GeocodingCandidate candidate = GeocodingCandidate.builder()
.id("12345")
.name("Carrer de la Provença")
.locality("Barcelona")
.countryCode("ESP")
.postalCode("08013")
.coord(new Coordinate(41.3851, 2.1734))
.type(GeocodingCandidateType.ADDRESS)
.build();
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns a newGeocodingCandidateinstance.coord(Coordinate coord) Sets the geographic coordinates.Sets the country name.countryCode(String countryCode) Sets the country code (ISO 3166-1).Sets the district name.districtCode(String districtCode) Sets the district code/identifier.houseNumber(String houseNumber) Sets the house number.Sets the unique identifier for this location.Sets the full address label or description.level(GeocodingLevel level) Sets the precision level of this geocoding result.Sets the locality (city) name.localityCode(String localityCode) Sets the locality (city) code/identifier.municipality(String municipality) Sets the municipality name.municipalityCode(String municipalityCode) Sets the municipality code/identifier.Sets the display name of this location.postalCode(String postalCode) Sets the postal code.Sets the region (state/autonomous community) name.regionCode(String regionCode) Sets the region (state/autonomous community) code/identifier.Sets the street name.streetCode(String streetCode) Sets the street code/identifier.Sets the subregion (province) name.subregionCode(String subregionCode) Sets the subregion (province) code/identifier.type(GeocodingCandidateType type) Sets the type of this geocoding result.
-
Method Details
-
id
Sets the unique identifier for this location.- Parameters:
id- the location identifier (required)- Returns:
- this Builder instance for method chaining
-
name
Sets the display name of this location.- Parameters:
name- the location name (required)- Returns:
- this Builder instance for method chaining
-
label
Sets the full address label or description.- Parameters:
label- the address label- Returns:
- this Builder instance for method chaining
-
street
Sets the street name.- Parameters:
street- the street name- Returns:
- this Builder instance for method chaining
-
streetCode
Sets the street code/identifier.- Parameters:
streetCode- the street code- Returns:
- this Builder instance for method chaining
-
locality
Sets the locality (city) name.- Parameters:
locality- the locality name- Returns:
- this Builder instance for method chaining
-
localityCode
Sets the locality (city) code/identifier.- Parameters:
localityCode- the locality code- Returns:
- this Builder instance for method chaining
-
municipality
Sets the municipality name.- Parameters:
municipality- the municipality name- Returns:
- this Builder instance for method chaining
-
municipalityCode
Sets the municipality code/identifier.- Parameters:
municipalityCode- the municipality code- Returns:
- this Builder instance for method chaining
-
district
Sets the district name.- Parameters:
district- the district name- Returns:
- this Builder instance for method chaining
-
districtCode
Sets the district code/identifier.- Parameters:
districtCode- the district code- Returns:
- this Builder instance for method chaining
-
subregion
Sets the subregion (province) name.- Parameters:
subregion- the subregion name- Returns:
- this Builder instance for method chaining
-
subregionCode
Sets the subregion (province) code/identifier.- Parameters:
subregionCode- the subregion code- Returns:
- this Builder instance for method chaining
-
region
Sets the region (state/autonomous community) name.- Parameters:
region- the region name- Returns:
- this Builder instance for method chaining
-
regionCode
Sets the region (state/autonomous community) code/identifier.- Parameters:
regionCode- the region code- Returns:
- this Builder instance for method chaining
-
country
Sets the country name.- Parameters:
country- the country name- Returns:
- this Builder instance for method chaining
-
countryCode
Sets the country code (ISO 3166-1).- Parameters:
countryCode- the country code (e.g., "ESP", "ES")- Returns:
- this Builder instance for method chaining
-
postalCode
Sets the postal code.- Parameters:
postalCode- the postal code- Returns:
- this Builder instance for method chaining
-
houseNumber
Sets the house number.- Parameters:
houseNumber- the house number- Returns:
- this Builder instance for method chaining
-
coord
Sets the geographic coordinates.- Parameters:
coord- the coordinate (required)- Returns:
- this Builder instance for method chaining
-
type
Sets the type of this geocoding result.- Parameters:
type- the result type (required)- Returns:
- this Builder instance for method chaining
-
level
Sets the precision level of this geocoding result.- Parameters:
level- the geocoding level- Returns:
- this Builder instance for method chaining
-
build
Builds and returns a newGeocodingCandidateinstance.Required fields (
id,name,coord,type) must be set before calling this method.- Returns:
- a new GeocodingCandidate instance
- Throws:
NullPointerException- if required fields are not set
-