Class GeoCodingBase<T extends GeoCodingBase<?>>

java.lang.Object
com.jbstrap.jbmap.geocoding.GeoCodingBase<T>
Type Parameters:
T - GeoCoding base class type
Direct Known Subclasses:
OSMGeoCoding

public abstract class GeoCodingBase<T extends GeoCodingBase<?>> extends Object

GeoCodingBase abstract base class. Extend this class to create a GeoCoding class. You can integrate any GeoCoding service provider in the created GeoCoding class.

In the GeoCoding process, a text description of a place (an address or a place name) returns the geographical coordinates of the place. Reverse GeoCoding means that geographical coordinates return the descrption of a place.

Since:
4.0
See Also:
  • Constructor Details

    • GeoCodingBase

      public GeoCodingBase(String baseUrl)
      Creates a GeoCodingBase.
      Parameters:
      baseUrl - GeoCoding service provider URL
      Throws:
      NullPointerException - Thrown if the "baseUrl" parameter is null
  • Method Details

    • getBaseUrl

      public String getBaseUrl()
      The base URL provided by a geocoding service.
      Returns:
      Base URL for the geocoding service
    • setPath

      protected T setPath(String path)
      Sets the path corresponding to the URL.
      Parameters:
      path - Path corresponding to the base URL
      Returns:
      Class instance extended from the GeoCodingBase abstract class
    • getPath

      protected String getPath()
      Gets the path associated with the URL.
      Returns:
      path The path associated with the base URL
    • setParam

      protected T setParam(String name, Object value)
      Adds a parameter to the GeoCoding service provider's URL address.
      Parameters:
      name - Parameter name
      value - Parameter value
      Returns:
      Class instance extended from the GeoCodingBase abstract class
      Throws:
      NullPointerException - Thrown if the value of the name parameter is null
    • removeParam

      protected T removeParam(String name)
      Removes a parameter from the GeoCoding service provider's URL address.
      Parameters:
      name - Parameter name
      Returns:
      Class instance extended from the GeoCodingBase abstract class
    • getParam

      protected Object getParam(String name)
      Gets a parameter from the GeoCoding service provider's URL address.
      Parameters:
      name - Parameter name
      Returns:
      Parameter value
    • prepareUrl

      public String prepareUrl()
    • search

      public abstract List<com.jbstrap.core.dao.Record> search(String searchText)
      Search abstract method. Required to implement. Use the setParam() method to set the text and the runQuery() method to perform the query. The returned result is a list of records (you specify this to the method).
      Parameters:
      searchText - Search address or place
      Returns:
      Search results in a list of records
    • runQuery

      protected List<com.jbstrap.core.dao.Record> runQuery()
      Initiates the search process using the URL and returns a list of records.
      Returns:
      Search results in a list of records
    • getTrustManager

      protected TrustManager[] getTrustManager()
      Gets the specified TrustManager.
      Returns:
      TrustManager or null if not specified
    • setTrustManager

      protected T setTrustManager(TrustManager[] trustManager)
      Custom TrustManager.
      Parameters:
      trustManager - Custom TrustManager TrustManager
      Returns:
      Class instance extended from the GeoCodingBase abstract class