Annotation Interface Mapper


@Retention(RUNTIME) @Target({METHOD,TYPE}) @Executable(processOnStartup=true) public @interface Mapper
An annotation that can be used on abstract methods for mapping, merging multiple objects. The method needs to define a single return type and at least one argument.

Inspired by similar frameworks like MapStruct but internally uses the BeanIntrospection model.

Since:
4.1.0
Author:
Graeme Rocher
  • Field Details

    • MERGE_STRATEGY_ALWAYS_OVERRIDE

      static final String MERGE_STRATEGY_ALWAYS_OVERRIDE
      A merge strategy to supply to mergeStrategy(). Properties from subsequent arguments will always override properties from previous arguments with the same name.
      See Also:
    • MERGE_STRATEGY_NOT_NULL_OVERRIDE

      static final String MERGE_STRATEGY_NOT_NULL_OVERRIDE
      A merge strategy to supply to mergeStrategy(). Non-null properties from subsequent arguments will override properties from previous arguments.
      See Also:
  • Element Details

    • value

      Returns:
      Defined mappings.
      Default:
      {}
    • conflictStrategy

      Mapper.ConflictStrategy conflictStrategy
      Returns:
      The conflict strategy.
      Default:
      CONVERT
    • mergeStrategy

      String mergeStrategy
      The merge strategy to use if method has more than one parameter.

      By default, any non-null property from subsequent arguments will override property with the same name from previous arguments.

      To define a custom strategy, create a named singleton of type Mapper.MergeStrategy and specify the same name here.

      Returns:
      The merge strategy
      Default:
      "NOT_NULL_OVERRIDE"