Interface AttributeConverter<X,​Y>

  • Type Parameters:
    X - The entity value type
    Y - The persisted value type

    @Indexed(AttributeConverter.class)
    public interface AttributeConverter<X,​Y>
    The attribute converter is used for converting mapped entity value to the persisted value and back.
    Since:
    3.1
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      X convertToEntityValue​(Y persistedValue, io.micronaut.core.convert.ConversionContext context)
      Converts the persisted value to the entity value.
      Y convertToPersistedValue​(X entityValue, io.micronaut.core.convert.ConversionContext context)
      Converts the entity value to the persisted value.
    • Method Detail

      • convertToPersistedValue

        @Nullable
        Y convertToPersistedValue​(@Nullable
                                  X entityValue,
                                  @NonNull
                                  io.micronaut.core.convert.ConversionContext context)
        Converts the entity value to the persisted value.
        Parameters:
        entityValue - The entity value
        context - The conversion context.
        Returns:
        the persisted value
      • convertToEntityValue

        @Nullable
        X convertToEntityValue​(@Nullable
                               Y persistedValue,
                               @NonNull
                               io.micronaut.core.convert.ConversionContext context)
        Converts the persisted value to the entity value.
        Parameters:
        persistedValue - The persisted value
        context - The conversion context.
        Returns:
        the entity value