Class GeoLinearRing

java.lang.Object
com.azure.core.models.GeoLinearRing
All Implemented Interfaces:
com.azure.json.JsonSerializable<GeoLinearRing>

public final class GeoLinearRing extends Object implements com.azure.json.JsonSerializable<GeoLinearRing>
Represents a linear ring that is part of a GeoPolygon.
  • Constructor Details

    • GeoLinearRing

      public GeoLinearRing(List<GeoPosition> coordinates)
      Constructs a new linear ring with the passed coordinates.
      Parameters:
      coordinates - The coordinates of the linear ring.
      Throws:
      NullPointerException - If coordinates is null.
      IllegalArgumentException - If coordinates has less than 4 elements or the first and last elements aren't equivalent.
  • Method Details

    • getCoordinates

      public List<GeoPosition> getCoordinates()
      Unmodifiable representation of the geometric positions representing this linear ring.
      Returns:
      An unmodifiable representation of the geometric positions representing this linear ring.
    • 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<GeoLinearRing>
      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 GeoLinearRing fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads a JSON stream into a GeoLinearRing.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      The GeoLinearRing that the JSON stream represented, or null if it pointed to JSON null.
      Throws:
      IOException - If a GeoLinearRing fails to be read from the jsonReader.