Package jakarta.nosql

Annotation Interface Convert


@Retention(RUNTIME) @Target({FIELD,PARAMETER}) public @interface Convert
Specifies how the values of a field or property are converted to a basic type or a type that can be persisted by a persistence provider.

The Convert annotation may be applied to any field or property and must be used in conjunction with the Id or Column annotation (if not, a default value will be used).

The dot notation may also be used with map entries:

Convert a basic attribute

 
 @Converter
 public class BooleanToIntegerConverter
         implements AttributeConverter<Boolean, Integer> {  ... }

 @Entity
 public class Employee {
     @Id
     long id;

     @Convert(converter = BooleanToIntegerConverter.class)
     boolean fullTime;
 }
 
Since:
1.0.0
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<? extends AttributeConverter<?,?>>
    Specifies the converter to be applied.
  • Element Details

    • value

      Class<? extends AttributeConverter<?,?>> value
      Specifies the converter to be applied.
      Returns:
      the converter class