Record Class Polygon
java.lang.Object
java.lang.Record
io.micronaut.data.model.geo.Polygon
- Record Components:
lineStrings- the closed rings that make up the polygon
- All Implemented Interfaces:
Geometry
@TypeDef(type=STRING,
converter=GeometryJsonConverter.class)
public record Polygon(List<LineString> lineStrings)
extends Record
implements Geometry
Represents a polygon defined by one or more closed
LineString rings.
The first ring describes the outer boundary and any subsequent rings describe holes, matching the GeoJSON Polygon structure.
- Since:
- 5.0
-
Constructor Summary
ConstructorsConstructorDescriptionPolygon(List<LineString> lineStrings) Creates an instance of aPolygonrecord class. -
Method Summary
Modifier and TypeMethodDescriptionasCoords()Returns this polygon as a list of ring coordinate sequences.final booleanIndicates whether some other object is "equal to" this one.static PolygonfromCoords(List<List<List<Double>>> coords) Creates aPolygonfrom a list of ring coordinate sequences.final inthashCode()Returns a hash code value for this object.Returns the value of thelineStringsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Polygon
Creates an instance of aPolygonrecord class.- Parameters:
lineStrings- the value for thelineStringsrecord component
-
-
Method Details
-
asCoords
-
fromCoords
Creates aPolygonfrom a list of ring coordinate sequences.- Parameters:
coords- the polygon ring coordinates to convert- Returns:
- a polygon created from the provided coordinates
- Throws:
IllegalArgumentException- ifcoordsisnull, empty, or describes an invalid polygon ring
-
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 withObjects::equals(Object,Object). -
lineStrings
Returns the value of thelineStringsrecord component.- Returns:
- the value of the
lineStringsrecord component
-