Share via


GeoObject Class

  • java.lang.Object
    • com.azure.core.models.GeoObject

Implements

public abstract class GeoObject
implements 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 jsonWriter) method to serialize the geometric object to JSON, and a fromJson(JsonReader jsonReader) method to deserialize a geometric object from JSON.

Constructor Summary

Modifier Constructor Description
protected GeoObject(GeoBoundingBox boundingBox, Map<String,Object> customProperties)

Creates a GeoObject instance.

Method Summary

Modifier and Type Method and Description
boolean equals(Object obj)
static GeoObject fromJson(JsonReader jsonReader)

Reads an instance of GeoObject from the JsonReader.

final GeoBoundingBox getBoundingBox()

Bounding box for this GeoObject.

final Map<String,Object> getCustomProperties()

Additional properties about this GeoObject.

abstract GeoObjectType getType()

Gets the GeoJSON type for this object.

int hashCode()
JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

GeoObject

protected GeoObject(GeoBoundingBox boundingBox, Map<String,Object> customProperties)

Creates a GeoObject instance.

Parameters:

boundingBox - Optional bounding box of the GeoObject.
customProperties - Optional additional properties to associate to the GeoObject.

Method Details

equals

public boolean equals(Object obj)

Overrides:

GeoObject.equals(Object obj)

Parameters:

obj

fromJson

public static GeoObject fromJson(JsonReader jsonReader)

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:

IOException

- If the deserialized JSON object was missing any required properties or the polymorphic discriminator.

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.

getType

public abstract GeoObjectType getType()

Gets the GeoJSON type for this object.

Returns:

The GeoJSON type for this object.

hashCode

public int hashCode()

Overrides:

GeoObject.hashCode()

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to