Class GeoObject

java.lang.Object
com.azure.core.models.GeoObject
All Implemented Interfaces:
com.azure.json.JsonSerializable<GeoObject>
Direct Known Subclasses:
GeoCollection, GeoLineString, GeoLineStringCollection, GeoPoint, GeoPointCollection, GeoPolygon, GeoPolygonCollection

public abstract class GeoObject extends Object implements com.azure.json.JsonSerializable<GeoObject>
Represents an abstract geometric object in GeoJSON format.

This class encapsulates the common properties of a geometric object, including the bounding box and additional custom properties. It provides methods to access these properties.

This class also provides a toJson(JsonWriter) method to serialize the geometric object to JSON, and a fromJson(JsonReader) method to deserialize a geometric object from JSON.

See Also:
  • Constructor Details

  • Method Details

    • getType

      public abstract GeoObjectType getType()
      Gets the GeoJSON type for this object.
      Returns:
      The GeoJSON type for this object.
    • getBoundingBox

      public final GeoBoundingBox getBoundingBox()
      Bounding box for this GeoObject.
      Returns:
      The bounding box for this GeoObject.
    • getCustomProperties

      public final Map<String,Object> getCustomProperties()
      Additional properties about this GeoObject.
      Returns:
      An unmodifiable representation of the additional properties associated with this GeoObject.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<GeoObject>
      Throws:
      IOException
    • fromJson

      public static GeoObject fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of GeoObject from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of GeoObject if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties or the polymorphic discriminator.
      IOException - If an error occurs while reading the GeoObject.