Annotation Interface ConvertWith

@Retention(RUNTIME) @Target({ANNOTATION_TYPE,FIELD}) @Inherited @Documented @API(status=STABLE, since="6.0") public @interface ConvertWith
This annotation can be used to define either custom conversions for single attributes by specifying a custom Neo4jPersistentPropertyConverter and if needed, a custom factory to create that converter or the annotation can be used to build custom meta-annotated annotations like

Custom conversions are applied to both attributes of entities and parameters of repository methods that map to those attributes (which does apply to all derived queries and queries by example but not to string based queries).

Converters that have a default constructor don't need a dedicated factory. A dedicated factory will be provided with either this annotation and its values or with the meta annotated annotation, including all configuration available.

In case converterRef() is set to a non null and non-empty value, the mapping context will try to lookup a bean under the given name of type Neo4jPersistentPropertyConverter in the application context. If no such bean is found an exception will be thrown. This attribute has precedence over converter().

Michael J. Simons
  • Element Details

    • converter

      Class<? extends Neo4jPersistentPropertyConverter<?>> converter
      The converter to instantiated for converting attributes to properties and vice versa.
    • converterFactory

      Class<? extends Neo4jPersistentPropertyConverterFactory> converterFactory
      An alternative to converter(), for all the scenarios in which constructing a converter is more effort than a constructor call.
    • converterRef

      String converterRef
      An optional reference to a bean to be used as converter, must implement Neo4jPersistentPropertyConverter.