Class GeocodingCandidate.Builder

java.lang.Object
com.cercalia.sdk.model.geocoding.GeocodingCandidate.Builder
Enclosing class:
GeocodingCandidate

public static final class GeocodingCandidate.Builder extends Object
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 Details

    • id

      Sets the unique identifier for this location.
      Parameters:
      id - the location identifier (required)
      Returns:
      this Builder instance for method chaining
    • name

      public GeocodingCandidate.Builder name(String name)
      Sets the display name of this location.
      Parameters:
      name - the location name (required)
      Returns:
      this Builder instance for method chaining
    • label

      public GeocodingCandidate.Builder label(String label)
      Sets the full address label or description.
      Parameters:
      label - the address label
      Returns:
      this Builder instance for method chaining
    • street

      public GeocodingCandidate.Builder street(String street)
      Sets the street name.
      Parameters:
      street - the street name
      Returns:
      this Builder instance for method chaining
    • streetCode

      public GeocodingCandidate.Builder streetCode(String streetCode)
      Sets the street code/identifier.
      Parameters:
      streetCode - the street code
      Returns:
      this Builder instance for method chaining
    • locality

      public GeocodingCandidate.Builder locality(String locality)
      Sets the locality (city) name.
      Parameters:
      locality - the locality name
      Returns:
      this Builder instance for method chaining
    • localityCode

      public GeocodingCandidate.Builder localityCode(String localityCode)
      Sets the locality (city) code/identifier.
      Parameters:
      localityCode - the locality code
      Returns:
      this Builder instance for method chaining
    • municipality

      public GeocodingCandidate.Builder municipality(String municipality)
      Sets the municipality name.
      Parameters:
      municipality - the municipality name
      Returns:
      this Builder instance for method chaining
    • municipalityCode

      public GeocodingCandidate.Builder municipalityCode(String municipalityCode)
      Sets the municipality code/identifier.
      Parameters:
      municipalityCode - the municipality code
      Returns:
      this Builder instance for method chaining
    • district

      public GeocodingCandidate.Builder district(String district)
      Sets the district name.
      Parameters:
      district - the district name
      Returns:
      this Builder instance for method chaining
    • districtCode

      public GeocodingCandidate.Builder districtCode(String districtCode)
      Sets the district code/identifier.
      Parameters:
      districtCode - the district code
      Returns:
      this Builder instance for method chaining
    • subregion

      public GeocodingCandidate.Builder subregion(String subregion)
      Sets the subregion (province) name.
      Parameters:
      subregion - the subregion name
      Returns:
      this Builder instance for method chaining
    • subregionCode

      public GeocodingCandidate.Builder subregionCode(String subregionCode)
      Sets the subregion (province) code/identifier.
      Parameters:
      subregionCode - the subregion code
      Returns:
      this Builder instance for method chaining
    • region

      public GeocodingCandidate.Builder region(String region)
      Sets the region (state/autonomous community) name.
      Parameters:
      region - the region name
      Returns:
      this Builder instance for method chaining
    • regionCode

      public GeocodingCandidate.Builder regionCode(String regionCode)
      Sets the region (state/autonomous community) code/identifier.
      Parameters:
      regionCode - the region code
      Returns:
      this Builder instance for method chaining
    • country

      public GeocodingCandidate.Builder country(String country)
      Sets the country name.
      Parameters:
      country - the country name
      Returns:
      this Builder instance for method chaining
    • countryCode

      public GeocodingCandidate.Builder countryCode(String 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

      public GeocodingCandidate.Builder postalCode(String postalCode)
      Sets the postal code.
      Parameters:
      postalCode - the postal code
      Returns:
      this Builder instance for method chaining
    • houseNumber

      public GeocodingCandidate.Builder houseNumber(String houseNumber)
      Sets the house number.
      Parameters:
      houseNumber - the house number
      Returns:
      this Builder instance for method chaining
    • coord

      public GeocodingCandidate.Builder coord(Coordinate 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

      public GeocodingCandidate build()
      Builds and returns a new GeocodingCandidate instance.

      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