Annotation Type Convert


  • @Target({METHOD,FIELD})
    @Retention(RUNTIME)
    public @interface Convert
    The Convert annotation specifies that a named converter should be used with the corresponding mapped attribute. The Convert annotation has the following reserved names:
    • serialized: Will use a SerializedObjectConverter on the associated mapping. When using a SerializedObjectConverter the database representation is a binary field holding a serialized version of the object and the object-model representation is a the actual object.
    • class-instance: Will use an ClassInstanceConverter on the associated mapping. When using a ClassInstanceConverter the database representation is a String representing the Class name and the object-model representation is an instance of that class built with a no-args constructor.
    • xml: Will use an SerializedObjectConverter with the XMLSerializer on the associated mapping. When using a XMLSerializer the database representation is a character field holding a serialized version of the object and the object-model representation is a the actual object.
    • json: Will use an SerializedObjectConverter with the JSONSerializer on the associated mapping. When using a JSONSerializer the database representation is a character field holding a serialized version of the object and the object-model representation is a the actual object.
    • kryo: Will use an SerializedObjectConverter with the KryoSerializer on the associated mapping. When using a KryoSerializer the database representation is a binary field holding a serialized version of the object and the object-model representation is a the actual object.
    • none - Will place no converter on the associated mapping. This can be used to override a situation where either another converter is defaulted or another converter is set.
    When these reserved converters are not used, it is necessary to define a converter to use using the @Converter annotation.
    See Also:
    Converter, ObjectTypeConverter, TypeConverter, SerializedObjectConverter, ClassInstanceConverter
    Author:
    Guy Pelletier
    Since:
    Oracle TopLink 11.1.1.0.0
    • Field Summary

      Fields 
      Modifier and Type Fields Description
      static java.lang.String CLASS_INSTANCE
      Constant name for the reserved class instance converter.
      static java.lang.String JSON
      Constant name for the reserved JSON converter.
      static java.lang.String KRYO
      Constant name for the reserved Kryo converter.
      static java.lang.String NONE
      Constant name for no converter.
      static java.lang.String SERIALIZED
      Constant name for the reserved Java serialization converter.
      static java.lang.String XML
      Constant name for the reserved XML converter.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String value
      (Optional) The name of the converter to be used.
    • Field Detail

      • SERIALIZED

        static final java.lang.String SERIALIZED
        Constant name for the reserved Java serialization converter. This will serialize the
      • CLASS_INSTANCE

        static final java.lang.String CLASS_INSTANCE
        Constant name for the reserved class instance converter. This will store the object's class name, and create a new instance of the class on read.
      • XML

        static final java.lang.String XML
        Constant name for the reserved XML converter. This will use JAXB to convert the object to and from XML.
      • JSON

        static final java.lang.String JSON
        Constant name for the reserved JSON converter. This will use EclipseLink Moxy JAXB to convert the object to and from JSON.
      • KRYO

        static final java.lang.String KRYO
        Constant name for the reserved Kryo converter. This will use Kryo to convert the object to and from an optimized binary format.
      • NONE

        static final java.lang.String NONE
        Constant name for no converter.
    • Element Detail

      • value

        java.lang.String value
        (Optional) The name of the converter to be used.
        Default:
        "none"