mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#761 using fully qualified names in javadoc for conflicting annotations
This commit is contained in:
parent
5e88dae8ce
commit
15b6afef58
@ -89,13 +89,14 @@ import java.lang.annotation.Target;
|
|||||||
* <h4>Referencing the original mapper in the decorator</h4>
|
* <h4>Referencing the original mapper in the decorator</h4>
|
||||||
* <p>
|
* <p>
|
||||||
* The generated implementation of the original mapper is annotated with the Spring annotation
|
* The generated implementation of the original mapper is annotated with the Spring annotation
|
||||||
* {@code @Qualifier("delegate")}. To autowire that bean in your decorator, add that qualifier annotation as well:
|
* {@code @org.springframework.beans.factory.annotation.Qualifier("delegate")}. To autowire that bean in your decorator,
|
||||||
|
* add that qualifier annotation as well:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* public abstract class PersonMapperDecorator implements PersonMapper {
|
* public abstract class PersonMapperDecorator implements PersonMapper {
|
||||||
*
|
*
|
||||||
* @Autowired
|
* @Autowired
|
||||||
* @Qualifier("delegate")
|
* @org.springframework.beans.factory.annotation.Qualifier("delegate")
|
||||||
* private PersonMapper delegate;
|
* private PersonMapper delegate;
|
||||||
*
|
*
|
||||||
* @Override
|
* @Override
|
||||||
@ -122,16 +123,16 @@ import java.lang.annotation.Target;
|
|||||||
* <h4>Referencing the original mapper</h4>
|
* <h4>Referencing the original mapper</h4>
|
||||||
* <p>
|
* <p>
|
||||||
* JSR 330 doesn't specify qualifiers and only allows to specifically name the beans. Hence, the generated
|
* JSR 330 doesn't specify qualifiers and only allows to specifically name the beans. Hence, the generated
|
||||||
* implementation of the original mapper is annotated with {@code @Named("fully-qualified-name-of-generated-impl")}
|
* implementation of the original mapper is annotated with
|
||||||
* and {@code @Singleton} (please note that when using a decorator, the class name of the mapper implementation ends
|
* {@code @javax.inject.Named("fully-qualified-name-of-generated-impl")} and {@code @Singleton} (please note that when
|
||||||
* with an underscore). To inject that bean in your decorator, add the same annotation to the delegate field (e.g. by
|
* using a decorator, the class name of the mapper implementation ends with an underscore). To inject that bean in your
|
||||||
* copy/pasting it from the generated class):
|
* decorator, add the same annotation to the delegate field (e.g. by copy/pasting it from the generated class):
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* public abstract class PersonMapperDecorator implements PersonMapper {
|
* public abstract class PersonMapperDecorator implements PersonMapper {
|
||||||
*
|
*
|
||||||
* @Inject
|
* @Inject
|
||||||
* @Named("org.examples.PersonMapperImpl_")
|
* @javax.inject.Named("org.examples.PersonMapperImpl_")
|
||||||
* private PersonMapper delegate;
|
* private PersonMapper delegate;
|
||||||
*
|
*
|
||||||
* @Override
|
* @Override
|
||||||
@ -147,12 +148,12 @@ import java.lang.annotation.Target;
|
|||||||
* <h4>Using the decorated mapper in the decorator</h4>
|
* <h4>Using the decorated mapper in the decorator</h4>
|
||||||
* <p>
|
* <p>
|
||||||
* Unlike with the other component models, the usage site must be aware if a mapper is decorated or not, as for
|
* Unlike with the other component models, the usage site must be aware if a mapper is decorated or not, as for
|
||||||
* decorated mappers, the parameterless {@code @Named} annotation must be added to select the <em>decorator</em> to be
|
* decorated mappers, the parameterless {@code @javax.inject.Named} annotation must be added to select the
|
||||||
* injected:
|
* <em>decorator</em> to be injected:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* @Inject
|
* @Inject
|
||||||
* @Named
|
* @javax.inject.Named
|
||||||
* private PersonMapper personMapper; // injects the decorator, with the injected original mapper
|
* private PersonMapper personMapper; // injects the decorator, with the injected original mapper
|
||||||
* </pre>
|
* </pre>
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -74,7 +74,7 @@ public @interface Mapper {
|
|||||||
* {@code spring}: the generated mapper is a Spring bean and
|
* {@code spring}: the generated mapper is a Spring bean and
|
||||||
* can be retrieved via {@code @Autowired}</li>
|
* can be retrieved via {@code @Autowired}</li>
|
||||||
* <li>
|
* <li>
|
||||||
* {@code jsr330}: the generated mapper is annotated with {@code @Named} and
|
* {@code jsr330}: the generated mapper is annotated with {@code @javax.inject.Named} and
|
||||||
* {@code @Singleton}, and can be retrieved via {@code @Inject}</li>
|
* {@code @Singleton}, and can be retrieved via {@code @Inject}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* The method overrides an unmappedTargetPolicy set in a central configuration set
|
* The method overrides an unmappedTargetPolicy set in a central configuration set
|
||||||
|
@ -76,7 +76,7 @@ public @interface MapperConfig {
|
|||||||
* {@code spring}: the generated mapper is a Spring bean and
|
* {@code spring}: the generated mapper is a Spring bean and
|
||||||
* can be retrieved via {@code @Autowired}</li>
|
* can be retrieved via {@code @Autowired}</li>
|
||||||
* <li>
|
* <li>
|
||||||
* {@code jsr330}: the generated mapper is annotated with {@code @Named} and
|
* {@code jsr330}: the generated mapper is annotated with {@code @javax.inject.Named} and
|
||||||
* {@code @Singleton}, and can be retrieved via {@code @Inject}</li>
|
* {@code @Singleton}, and can be retrieved via {@code @Inject}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user