Class ProjectionConverter<F,​V>

  • Type Parameters:
    F - The type of source values obtained from the backend.
    V - The type of projected values.

    public final class ProjectionConverter<F,​V>
    extends Object
    A converter from a value obtained from the backend to a projected value.
    • Method Detail

      • valueType

        public Class<V> valueType()
      • convert

        public V convert​(F value,
                         FromDocumentFieldValueConvertContext context)
        value - The index field value to convert.
        context - A context that can be extended to a more useful type, giving access to such things as a Hibernate ORM Session (if using the Hibernate ORM mapper).
        The converted value.
      • withConvertedType

        public <T> ProjectionConverter<F,​? extends T> withConvertedType​(Class<T> expectedType,
                                                                              EventContextProvider eventContextProvider)
        Check whether projected values can be assigned to the given type, and returns the projection converter with an appropriate type.
        Type Parameters:
        T - A candidate type for assignment of converted values.
        expectedType - A candidate type for assignment of converted values.
        eventContextProvider - A provider for the event context to pass to produced exceptions.
        The projection converter, guaranteed to convert values to the given type.
        SearchException - If the projection converter cannot convert values to the given type.