Annotation Interface Converter


@Retention(RUNTIME) @Documented @Target({TYPE,METHOD}) public @interface Converter
An annotation used to mark classes and methods to indicate code capable of converting from a type to another type which are then auto-discovered using the Type Conversion Support
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether returning null is a valid response.
    boolean
    Whether this converter is a regular converter or a fallback converter.
    boolean
    Whether this fallback converter can be promoted to a first class type converter.
    boolean
    Whether to let the Camel compiler plugin to generate java source code for fast loading of the type converters, bulked together into a single class for optimal performance.
    boolean
    Whether to let the Camel compiler plugin to generate java source code for fast loading of the type converters.
    boolean
    Whether to ignore the type converter if it cannot be loaded for some reason.
    int
    To be used for ordering converter methods when source code generating bulk loaders.
  • Element Details

    • allowNull

      boolean allowNull
      Whether returning null is a valid response.
      Default:
      false
    • fallback

      boolean fallback
      Whether this converter is a regular converter or a fallback converter. Important: Fallback type converters is not recommended being used by Camel end users, but are used by Camel internally and for some special Camel components. The difference between a regular converter and a fallback-converter is that the fallback is resolved at last if no regular converter could be found. The method signature is scoped to be generic to allow handling a broader range of types trying to be converted. The fallback converter can just return null if it can not handle the types to convert from/to.
      Default:
      false
    • fallbackCanPromote

      boolean fallbackCanPromote
      Whether this fallback converter can be promoted to a first class type converter.
      Default:
      false
    • ignoreOnLoadError

      boolean ignoreOnLoadError
      Whether to ignore the type converter if it cannot be loaded for some reason.

      This can be used if a Camel component provides multiple components where the end user can opt-out some of these components by excluding dependencies on the classpath, meaning the type converter would not be able to load due class not found errors. But in those cases its okay as the component is opted-out.

      Important this configuration must be set on the class-level, not on the method.

      Default:
      false
    • generateLoader

      boolean generateLoader
      Whether to let the Camel compiler plugin to generate java source code for fast loading of the type converters.

      Important this configuration must be set on the class-level, not on the method.

      Default:
      false
    • generateBulkLoader

      boolean generateBulkLoader
      Whether to let the Camel compiler plugin to generate java source code for fast loading of the type converters, bulked together into a single class for optimal performance.

      This can be done for almost all regular type converters, and not for fallback converters.

      Important this configuration must be set on the class-level, not on the method.

      Default:
      false
    • order

      int order
      To be used for ordering converter methods when source code generating bulk loaders. The order is lowest to highest, eg 1, 2, 3.
      Default:
      0