Class GeocodingOptions.Builder

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

public static final class GeocodingOptions.Builder extends Object
Builder for constructing GeocodingOptions instances.

Supports both structured search (by address components) and free-form text search. All setter methods return this for method chaining.


 // Structured search
 GeocodingOptions options = GeocodingOptions.builder()
     .street("Carrer de la Provença")
     .locality("Barcelona")
     .countryCode("ESP")
     .build();

 // Free-form search
 GeocodingOptions options = GeocodingOptions.builder()
     .query("Provença 5, Barcelona")
     .fullSearch(true)
     .build();
 
  • Method Details

    • query

      public GeocodingOptions.Builder query(String query)
      Sets the free-form text query.

      When set, this takes precedence over structured address components.

      Parameters:
      query - the text to search for
      Returns:
      this Builder instance for method chaining
    • country

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

      public GeocodingOptions.Builder countryCode(String countryCode)
      Sets the country code (ISO 3166-1).

      Recommended to use 2-letter codes (e.g., "ES") or 3-letter codes (e.g., "ESP"). Default is "ESP" if not specified.

      Parameters:
      countryCode - the country code
      Returns:
      this Builder instance for method chaining
    • locality

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

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

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

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

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

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

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

      public GeocodingOptions.Builder limit(Integer limit)
      Sets the maximum number of results to return.

      If not specified, API's default limit is used.

      Parameters:
      limit - the maximum number of results (positive integer)
      Returns:
      this Builder instance for method chaining
    • fullSearch

      public GeocodingOptions.Builder fullSearch(Boolean fullSearch)
      Enables or disables full search mode.

      When enabled, performs a more exhaustive search that may include partial matches and broader results.

      Parameters:
      fullSearch - true to enable full search, false otherwise
      Returns:
      this Builder instance for method chaining
    • build

      public GeocodingOptions build()
      Builds and returns a new GeocodingOptions instance.
      Returns:
      a new GeocodingOptions instance