android-maps-utils icon indicating copy to clipboard operation
android-maps-utils copied to clipboard

chore: Convert data types to Kotlin

Open dkhawk opened this issue 4 months ago • 1 comments

This pull request refactors several core data classes from Java to Kotlin. This modernization improves code readability, safety, and conciseness by leveraging Kotlin features like properties, val, and non-nullable types.

Summary of Changes

  • DataPolygon.java -> DataPolygon.kt: Converted the DataPolygon interface to Kotlin. It now uses val properties for outerBoundaryCoordinates and innerBoundaryCoordinates.
  • Feature.java -> Feature.kt: Converted the Feature class to Kotlin. This includes:
    • Replacing Java getters and setters (getGeometry, getProperties, hasProperty) with Kotlin properties (geometry, properties, hasProperty).
    • Using a private backing property (_properties) for the mutable map to expose an immutable view.
  • Geometry.java -> Geometry.kt: Converted the Geometry interface to Kotlin, using val properties for geometryType and geometryObject.
  • Layer.java -> Layer.kt: Converted the Layer abstract class to Kotlin. It now uses generic types for Feature and uses Kotlin's property access syntax for renderer (renderer.map instead of renderer.getMap()).
  • LineString.java -> LineString.kt: Converted the LineString class to Kotlin, using val properties for its data and adding equals and hashCode implementations.
  • MultiGeometry.java -> MultiGeometry.kt: Converted the MultiGeometry class to Kotlin. The constructor now enforces non-nullability, and the getGeometryType method is replaced with an override property.
  • Point.java -> Point.kt: Converted the Point class to Kotlin, using val properties for its data and including equals, hashCode, and toString overrides.

dkhawk avatar Aug 29 '25 22:08 dkhawk