Package io.micronaut.context.annotation
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe conflict strategy specifies the behaviour if a conflict is found.static @interfaceThe mappings.static interfaceAn interface for defining merge strategies. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe merge strategy to use if method has more than one parameter. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA merge strategy to supply tomergeStrategy().static final StringA merge strategy to supply tomergeStrategy().
-
Field Details
-
MERGE_STRATEGY_ALWAYS_OVERRIDE
A merge strategy to supply tomergeStrategy(). Properties from subsequent arguments will always override properties from previous arguments with the same name.- See Also:
-
MERGE_STRATEGY_NOT_NULL_OVERRIDE
A merge strategy to supply tomergeStrategy(). Non-null properties from subsequent arguments will override properties from previous arguments.- See Also:
-
-
Element Details
-
value
Mapper.Mapping[] value- Returns:
- Defined mappings.
- Default:
- {}
-
conflictStrategy
Mapper.ConflictStrategy conflictStrategy- Returns:
- The conflict strategy.
- Default:
- CONVERT
-
mergeStrategy
String mergeStrategyThe 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.MergeStrategyand specify the same name here.- Returns:
- The merge strategy
- Default:
- "NOT_NULL_OVERRIDE"
-