Class GeometryJsonConverter

java.lang.Object
io.micronaut.data.model.runtime.convert.GeometryJsonConverter
All Implemented Interfaces:
AttributeConverter<Geometry,String>

@Singleton public final class GeometryJsonConverter extends Object implements AttributeConverter<Geometry,String>
Converts Geometry values to and from their GeoJSON string representation.

This converter is used for geo model types that are persisted as JSON text and supports all Micronaut Data geometry implementations, including nested GeometryCollection values.

Since:
5.0
  • Method Details

    • convertToPersistedValue

      public @Nullable String convertToPersistedValue(@Nullable Geometry entityValue, io.micronaut.core.convert.ConversionContext context)
      Description copied from interface: AttributeConverter
      Converts the entity value to the persisted value.
      Specified by:
      convertToPersistedValue in interface AttributeConverter<Geometry,String>
      Parameters:
      entityValue - The entity value
      context - The conversion context.
      Returns:
      the persisted value
    • convertToEntityValue

      public @Nullable Geometry convertToEntityValue(@Nullable String persistedValue, io.micronaut.core.convert.ConversionContext context)
      Description copied from interface: AttributeConverter
      Converts the persisted value to the entity value.
      Specified by:
      convertToEntityValue in interface AttributeConverter<Geometry,String>
      Parameters:
      persistedValue - The persisted value
      context - The conversion context.
      Returns:
      the entity value