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>
An abstract geo object.
  • 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
      Description copied from interface: com.azure.json.JsonSerializable
      Writes the object to the passed JsonWriter.

      The contract for writing JSON to JsonWriter is that the object being written will handle opening and closing its own JSON object. So, for objects calling out to other JsonSerializable objects for serialization, they'll write the field name only then pass the JsonWriter to the other JsonSerializable object. This way objects writing JSON will be self-encapsulated for writing properly formatted JSON.

      Specified by:
      toJson in interface com.azure.json.JsonSerializable<GeoObject>
      Parameters:
      jsonWriter - Where the object's JSON will be written.
      Returns:
      The JsonWriter where the JSON was written.
      Throws:
      IOException - If the object fails to be written to the jsonWriter.
    • 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.