mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
Javadoc and documentation polishing (#3026)
This commit is contained in:
parent
45e01fea91
commit
b1eda5a04e
@ -98,7 +98,7 @@ public @interface EnumMapping {
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link MappingConstants#SUFFIX_TRANSFORMATION} - applies the given {@link #configuration()} as a
|
* <li>{@link MappingConstants#SUFFIX_TRANSFORMATION} - applies the given {@link #configuration()} as a
|
||||||
* suffix to the source enum</li>
|
* suffix to the source enum</li>
|
||||||
* <li>{@link MappingConstants#STRIP_SUFFIX_TRANSFORMATION} - strips the the given {@link #configuration()}
|
* <li>{@link MappingConstants#STRIP_SUFFIX_TRANSFORMATION} - strips the given {@link #configuration()}
|
||||||
* from the end of the source enum</li>
|
* from the end of the source enum</li>
|
||||||
* <li>{@link MappingConstants#PREFIX_TRANSFORMATION} - applies the given {@link #configuration()} as a
|
* <li>{@link MappingConstants#PREFIX_TRANSFORMATION} - applies the given {@link #configuration()} as a
|
||||||
* prefix to the source enum</li>
|
* prefix to the source enum</li>
|
||||||
|
@ -8,7 +8,7 @@ package org.mapstruct;
|
|||||||
/**
|
/**
|
||||||
* Strategy for dealing with null source values.
|
* Strategy for dealing with null source values.
|
||||||
*
|
*
|
||||||
* <b>Note:</b> This strategy is not in effect when the a specific source presence check method is defined
|
* <b>Note:</b> This strategy is not in effect when a specific source presence check method is defined
|
||||||
* in the service provider interface (SPI).
|
* in the service provider interface (SPI).
|
||||||
* <p>
|
* <p>
|
||||||
* <b>Note</b>: some types of mappings (collections, maps), in which MapStruct is instructed to use a getter or adder
|
* <b>Note</b>: some types of mappings (collections, maps), in which MapStruct is instructed to use a getter or adder
|
||||||
|
@ -176,7 +176,7 @@ public abstract class HelperMethod implements Method {
|
|||||||
*
|
*
|
||||||
* @param parameter source
|
* @param parameter source
|
||||||
* @param returnType target
|
* @param returnType target
|
||||||
* @return {@code true}, iff the the type variables match
|
* @return {@code true}, iff the type variables match
|
||||||
*/
|
*/
|
||||||
public boolean doTypeVarsMatch(Type parameter, Type returnType) {
|
public boolean doTypeVarsMatch(Type parameter, Type returnType) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -190,7 +190,7 @@ public abstract class BuiltInMethod implements Method {
|
|||||||
*
|
*
|
||||||
* @param parameter source
|
* @param parameter source
|
||||||
* @param returnType target
|
* @param returnType target
|
||||||
* @return {@code true}, iff the the type variables match
|
* @return {@code true}, iff the type variables match
|
||||||
*/
|
*/
|
||||||
public boolean doTypeVarsMatch(Type parameter, Type returnType) {
|
public boolean doTypeVarsMatch(Type parameter, Type returnType) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -159,7 +159,7 @@ public enum Message {
|
|||||||
RETRIEVAL_NO_INPUT_ARGS( "Can't generate mapping method with no input arguments." ),
|
RETRIEVAL_NO_INPUT_ARGS( "Can't generate mapping method with no input arguments." ),
|
||||||
RETRIEVAL_DUPLICATE_MAPPING_TARGETS( "Can't generate mapping method with more than one @MappingTarget parameter." ),
|
RETRIEVAL_DUPLICATE_MAPPING_TARGETS( "Can't generate mapping method with more than one @MappingTarget parameter." ),
|
||||||
RETRIEVAL_VOID_MAPPING_METHOD( "Can't generate mapping method with return type void." ),
|
RETRIEVAL_VOID_MAPPING_METHOD( "Can't generate mapping method with return type void." ),
|
||||||
RETRIEVAL_NON_ASSIGNABLE_RESULTTYPE( "The result type is not assignable to the the return type." ),
|
RETRIEVAL_NON_ASSIGNABLE_RESULTTYPE( "The result type is not assignable to the return type." ),
|
||||||
RETRIEVAL_ITERABLE_TO_NON_ITERABLE( "Can't generate mapping method from iterable type from java stdlib to non-iterable type." ),
|
RETRIEVAL_ITERABLE_TO_NON_ITERABLE( "Can't generate mapping method from iterable type from java stdlib to non-iterable type." ),
|
||||||
RETRIEVAL_MAPPING_HAS_TARGET_TYPE_PARAMETER( "Can't generate mapping method that has a parameter annotated with @TargetType." ),
|
RETRIEVAL_MAPPING_HAS_TARGET_TYPE_PARAMETER( "Can't generate mapping method that has a parameter annotated with @TargetType." ),
|
||||||
RETRIEVAL_NON_ITERABLE_TO_ITERABLE( "Can't generate mapping method from non-iterable type to iterable type from java stdlib." ),
|
RETRIEVAL_NON_ITERABLE_TO_ITERABLE( "Can't generate mapping method from non-iterable type to iterable type from java stdlib." ),
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
<#else>
|
<#else>
|
||||||
<#-- Streams are immutable so we can't update them -->
|
<#-- Streams are immutable so we can't update them -->
|
||||||
<#if !existingInstanceMapping>
|
<#if !existingInstanceMapping>
|
||||||
<#--TODO fhr: after the the result is no longer the same instance, how does it affect the
|
<#--TODO fhr: after the result is no longer the same instance, how does it affect the
|
||||||
Before mapping methods. Does it even make sense to have before mapping on a stream? -->
|
Before mapping methods. Does it even make sense to have before mapping on a stream? -->
|
||||||
<#if sourceParameter.type.arrayType>
|
<#if sourceParameter.type.arrayType>
|
||||||
<@returnLocalVarDefOrUpdate>Stream.of( ${sourceParameter.name} )<@streamMapSupplier />;</@returnLocalVarDefOrUpdate>
|
<@returnLocalVarDefOrUpdate>Stream.of( ${sourceParameter.name} )<@streamMapSupplier />;</@returnLocalVarDefOrUpdate>
|
||||||
|
@ -23,8 +23,8 @@ public class Issue1719Test {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* For adder methods MapStuct cannot generate an update method. MapStruct would cannot know how to remove objects
|
* For adder methods MapStuct cannot generate an update method. MapStruct would cannot know how to remove objects
|
||||||
* from the child-parent relation. It cannot even assume that the the collection can be cleared at forehand.
|
* from the child-parent relation. It cannot even assume that the collection can be cleared at forehand.
|
||||||
* Therefore the only sensible choice is for MapStruct to create a create method for the target elements.
|
* Therefore, the only sensible choice is for MapStruct to create a create method for the target elements.
|
||||||
*/
|
*/
|
||||||
@ProcessorTest
|
@ProcessorTest
|
||||||
@WithClasses(Issue1719Mapper.class)
|
@WithClasses(Issue1719Mapper.class)
|
||||||
|
@ -19,7 +19,7 @@ import org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutco
|
|||||||
/**
|
/**
|
||||||
* Tests the erroneous usage of the {@link Context} annotation in the following situations:
|
* Tests the erroneous usage of the {@link Context} annotation in the following situations:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>using the the same context parameter type twice in the same method
|
* <li>using the same context parameter type twice in the same method
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author Andreas Gudian
|
* @author Andreas Gudian
|
||||||
|
12
readme.md
12
readme.md
@ -114,7 +114,7 @@ plugins {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
...
|
...
|
||||||
compile 'org.mapstruct:mapstruct:1.5.2.Final'
|
implementation 'org.mapstruct:mapstruct:1.5.2.Final'
|
||||||
|
|
||||||
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final'
|
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final'
|
||||||
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final' // if you are using mapstruct in test code
|
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final' // if you are using mapstruct in test code
|
||||||
@ -122,7 +122,7 @@ dependencies {
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't work with a dependency management tool, you can obtain a distribution bundle from [SourceForge](https://sourceforge.net/projects/mapstruct/files/).
|
If you don't work with a dependency management tool, you can obtain a distribution bundle from [Releases page](https://github.com/mapstruct/mapstruct/releases).
|
||||||
|
|
||||||
## Documentation and getting help
|
## Documentation and getting help
|
||||||
|
|
||||||
@ -132,16 +132,16 @@ To learn more about MapStruct, refer to the [project homepage](http://mapstruct.
|
|||||||
|
|
||||||
MapStruct uses Maven for its build. Java 11 is required for building MapStruct from source. To build the complete project, run
|
MapStruct uses Maven for its build. Java 11 is required for building MapStruct from source. To build the complete project, run
|
||||||
|
|
||||||
mvn clean install
|
./mvnw clean install
|
||||||
|
|
||||||
from the root of the project directory. To skip the distribution module, run
|
from the root of the project directory. To skip the distribution module, run
|
||||||
|
|
||||||
mvn clean install -DskipDistribution=true
|
./mvnw clean install -DskipDistribution=true
|
||||||
|
|
||||||
## Importing into IDE
|
## Importing into IDE
|
||||||
|
|
||||||
MapStruct uses the gem annotation processor to generate mapping gems for it's own annotations.
|
MapStruct uses the gem annotation processor to generate mapping gems for its own annotations.
|
||||||
Therefore for seamless integration within an IDE annotation processing needs to be enabled.
|
Therefore, for seamless integration within an IDE annotation processing needs to be enabled.
|
||||||
|
|
||||||
### IntelliJ
|
### IntelliJ
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user