Record Class Point
java.lang.Object
java.lang.Record
io.micronaut.data.model.geo.Point
- Record Components:
x- the x-coordinate (typically longitude)y- the y-coordinate (typically latitude)
- All Implemented Interfaces:
Geometry
@TypeDef(type=STRING,
converter=GeometryJsonConverter.class)
public record Point(double x, double y)
extends Record
implements Geometry
A record that represents a two-dimensional point with
x and y coordinates.
This record implements the Geometry interface and can be used in geographic
data models compliant with the GeoJSON specification. The coordinates are interpreted
as (longitude, latitude) or (x, y) depending on context.
- Since:
- 5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasCoords()Returns the coordinates of this point as a list of twoDoublevalues.final booleanIndicates whether some other object is "equal to" this one.static PointfromCoords(List<Double> coords) Creates aPointinstance from a list of coordinates.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.
-
Constructor Details
-
Point
-
-
Method Details
-
asCoords
-
fromCoords
Creates aPointinstance from a list of coordinates.- Parameters:
coords- a list containing exactly twoDoubleelements representing x and y- Returns:
- a new
Pointcreated from the given coordinates - Throws:
IllegalArgumentException- ifcoordsisnull, empty, or does not contain exactly two elements
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
x
-
y
-