com.datastax.dse.driver.api.core.data.geometry.Geometry Maven / Gradle / Ivy
/*
* Copyright DataStax, Inc.
*
* This software can be used solely with DataStax Enterprise. Please consult the license at
* http://www.datastax.com/terms/datastax-dse-driver-license-terms
*/
package com.datastax.dse.driver.api.core.data.geometry;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.nio.ByteBuffer;
/**
* The driver-side representation for a DSE geospatial type.
*
*
* Row row = dseSession.execute("SELECT coords FROM points_of_interest WHERE name = 'Eiffel Tower'").one();
* Point coords = row.get("coords", Point.class);
*
*
* The default implementations returned by the driver are immutable and serializable. If you write
* your own implementations, they should at least be thread-safe; serializability is not mandatory,
* but recommended for use with some 3rd-party tools like Apache Spark ™.
*/
public interface Geometry {
/**
* Returns a Well-known Text (WKT)
* representation of this geospatial type.
*/
@NonNull
String asWellKnownText();
/**
* Returns a Well-known
* Binary (WKB) representation of this geospatial type.
*
* Note that, due to DSE implementation details, the resulting byte buffer always uses
* little-endian order, regardless of the platform's native order.
*/
@NonNull
ByteBuffer asWellKnownBinary();
/** Returns a JSON representation of this geospatial type. */
@NonNull
String asGeoJson();
/**
* Tests whether this geospatial type instance contains another instance.
*
* @param other the other instance.
* @return whether {@code this} contains {@code other}.
*/
boolean contains(@NonNull Geometry other);
}