Class CadfGeolocation.Builder

  • Enclosing class:
    CadfGeolocation

    public static class CadfGeolocation.Builder
    extends java.lang.Object
    Builder is a convenience pattern to assemble to Java Object
    • Constructor Detail

      • Builder

        public Builder​(java.lang.String latitude,
                       java.lang.String longitude,
                       java.lang.Double elevation,
                       java.lang.Double accuracy)
        Geolocation builder using latitude/longitude values.
        Parameters:
        latitude - -- String. Latitude values adhere to the format based on ISO 6709:2008 Annex H.3.1 – H.3.3. [ISO-6709-2008]
        longitude - -- String. Longitude values adhere to the format based on ISO 6709:2008 Annex H.3.1 – H.3.3. [ISO-6709-2008]
        elevation - -- Double. Elevation in meters.
        accuracy - -- Double. Accuracy of geolocation, in meters.
      • Builder

        public Builder​(java.lang.String city,
                       java.lang.String state,
                       java.lang.String regionICANN,
                       java.lang.Double accuracy)
        Geolocation builder using city/state/region.
        Parameters:
        city - - String. Location city.
        state - - String. Location state or province, optional.
        regionICANN - - String. Location region -- ICANN country code per top level domain (ccTLD) naming convention [IANA-ccTLD]. May be upper- or lowercase.
        accuracy - -- Double. Accuracy of geolocation, in meters.
    • Method Detail

      • region

        public CadfGeolocation.Builder region​(java.lang.String regionICANN)
        Optionally add ICANN regioin data to the location created using latitude/longitude values.
        Parameters:
        regionICANN - - String. ICANN country code per top level domain (ccTLD) naming convention [IANA-ccTLD]. May be upper- or lowercase.
        Returns:
        Builder
      • id

        public CadfGeolocation.Builder id​(java.lang.String id)
        Optionally set the location identifier.
        Parameters:
        id - - String. URI of the location.
        Returns:
        This builder
      • annotations

        public CadfGeolocation.Builder annotations​(CadfMapItem[] annotations)
        Optionally set arbitrary annotations for this location
        Parameters:
        annotations - An array of key-value annotations
        Returns:
        This builder
      • annotations

        public CadfGeolocation.Builder annotations​(java.util.ArrayList<CadfMapItem> annotations)
        Optionally set arbitrary annotations for this location
        Parameters:
        annotations - An array of key-value annotations
        Returns:
        This builder
      • build

        public CadfGeolocation build()
                              throws java.lang.IllegalStateException
        Build an immutable geo-location object
        Returns:
        CadfGeolocation
        Throws:
        java.lang.IllegalStateException - when the properties do not meet the specification.