mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#168 Formatting
This commit is contained in:
parent
ec614a6e25
commit
bbeaa2117c
@ -79,7 +79,8 @@ public @interface MapMapping {
|
||||
/**
|
||||
* Specifies the type of the key to be used in the result of the mapping method in case multiple mapping
|
||||
* methods qualify.
|
||||
* *
|
||||
*
|
||||
*
|
||||
* @return the resultType to select
|
||||
*/
|
||||
Class<?> keyTargetType() default void.class;
|
||||
@ -87,7 +88,8 @@ public @interface MapMapping {
|
||||
/**
|
||||
* Specifies the type of the value to be used in the result of the mapping method in case multiple mapping
|
||||
* methods qualify.
|
||||
* *
|
||||
*
|
||||
*
|
||||
* @return the resultType to select
|
||||
*/
|
||||
Class<?> valueTargetType() default void.class;
|
||||
|
@ -55,6 +55,7 @@ public class Mappers {
|
||||
*
|
||||
* @param clazz The type of the mapper to return.
|
||||
* @param <T> The type of the mapper to create.
|
||||
*
|
||||
* @return An instance of the given mapper type.
|
||||
*/
|
||||
public static <T> T getMapper(Class<T> clazz) {
|
||||
|
@ -412,7 +412,8 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
* per the source/target type and optionally the name given via {@code @InheritInverseConfiguration}).
|
||||
*/
|
||||
private MappingOptions getInverseMappingOptions(List<SourceMethod> rawMethods, SourceMethod method,
|
||||
List<SourceMethod> initializingMethods, MapperConfiguration mapperConfig) {
|
||||
List<SourceMethod> initializingMethods,
|
||||
MapperConfiguration mapperConfig) {
|
||||
SourceMethod resultMethod = null;
|
||||
InheritInverseConfigurationPrism reversePrism = InheritInverseConfigurationPrism.getInstanceOn(
|
||||
method.getExecutable()
|
||||
|
@ -29,8 +29,6 @@ import javax.lang.model.type.DeclaredType;
|
||||
import javax.lang.model.type.TypeKind;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MapperConfig;
|
||||
import org.mapstruct.ap.option.ReportingPolicy;
|
||||
import org.mapstruct.ap.prism.CollectionMappingStrategyPrism;
|
||||
import org.mapstruct.ap.prism.MapperConfigPrism;
|
||||
@ -40,12 +38,12 @@ import org.mapstruct.ap.prism.NullValueMappingPrism;
|
||||
import org.mapstruct.ap.prism.NullValueMappingStrategyPrism;
|
||||
|
||||
/**
|
||||
* Provides an aggregated view to the settings given via {@link Mapper} and {@link MapperConfig} for a specific mapper
|
||||
* class.
|
||||
* Provides an aggregated view to the settings given via {@link org.mapstruct.Mapper} and
|
||||
* {@link org.mapstruct.MapperConfig} for a specific mapper class.
|
||||
* <p>
|
||||
* Settings given via {@code Mapper} will generally take precedence over settings inherited from a referenced config
|
||||
* class. The lists of referenced mappers given via {@link Mapper#uses()} and {@link MapperConfig#uses() } will be
|
||||
* merged.
|
||||
* class. The lists of referenced mappers given via {@link org.mapstruct.Mapper#uses()} and
|
||||
* {@link org.mapstruct.MapperConfig#uses() } will be merged.
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.inheritfromconfig;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
public abstract class BaseVehicleDto {
|
||||
private long id;
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.inheritfromconfig;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
public abstract class BaseVehicleEntity {
|
||||
private long primaryKey;
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.inheritfromconfig;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
public class CarDto extends BaseVehicleDto {
|
||||
private String colour;
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.inheritfromconfig;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
public class CarEntity extends BaseVehicleEntity {
|
||||
private String color;
|
||||
|
@ -28,7 +28,6 @@ import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
@Mapper(
|
||||
config = AutoInheritedConfig.class
|
||||
|
@ -27,7 +27,6 @@ import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
@Mapper(
|
||||
config = AutoInheritedConfig.class,
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.inheritfromconfig;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
public class CarWithDriverEntity extends CarEntity {
|
||||
private String driverName;
|
||||
|
@ -24,7 +24,6 @@ import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
@Mapper(
|
||||
config = AutoInheritedDriverConfig.class
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.inheritfromconfig;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
public class DriverDto {
|
||||
private String name;
|
||||
|
@ -25,7 +25,6 @@ import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
@Mapper(
|
||||
config = Erroneous1Config.class
|
||||
|
@ -27,7 +27,6 @@ import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
@Mapper(
|
||||
config = AutoInheritedConfig.class
|
||||
|
@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.mapstruct.ap.test.inheritfromconfig;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
|
||||
import javax.tools.Diagnostic.Kind;
|
||||
|
||||
import org.junit.Test;
|
||||
@ -29,11 +31,8 @@ import org.mapstruct.ap.testutil.compilation.annotation.Diagnostic;
|
||||
import org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome;
|
||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Andreas Gudian
|
||||
*
|
||||
*/
|
||||
@RunWith(AnnotationProcessorTestRunner.class)
|
||||
@WithClasses({
|
||||
@ -43,7 +42,8 @@ import static org.fest.assertions.Assertions.assertThat;
|
||||
CarEntity.class,
|
||||
CarMapperWithAutoInheritance.class,
|
||||
CarMapperWithExplicitInheritance.class,
|
||||
AutoInheritedConfig.class } )
|
||||
AutoInheritedConfig.class
|
||||
})
|
||||
@IssueKey("168")
|
||||
public class InheritFromConfigTest {
|
||||
|
||||
@ -149,7 +149,8 @@ public class InheritFromConfigTest {
|
||||
DriverDto.class,
|
||||
CarWithDriverEntity.class,
|
||||
CarWithDriverMapperWithAutoInheritance.class,
|
||||
AutoInheritedDriverConfig.class } )
|
||||
AutoInheritedDriverConfig.class
|
||||
})
|
||||
public void autoInheritedFromMultipleSources() {
|
||||
CarDto carDto = newTestDto();
|
||||
DriverDto driverDto = new DriverDto();
|
||||
@ -169,25 +170,25 @@ public class InheritFromConfigTest {
|
||||
diagnostics = {
|
||||
@Diagnostic(type = Erroneous1Mapper.class,
|
||||
kind = Kind.ERROR,
|
||||
line = 37,
|
||||
line = 36,
|
||||
messageRegExp = "More than one configuration prototype method is applicable. Use @InheritConfiguration"
|
||||
+ " to select one of them explicitly:"
|
||||
+ " .*BaseVehicleEntity baseDtoToEntity\\(.*BaseVehicleDto dto\\),"
|
||||
+ " .*BaseVehicleEntity anythingToEntity\\(java.lang.Object anyting\\)\\."),
|
||||
@Diagnostic(type = Erroneous1Mapper.class,
|
||||
kind = Kind.WARNING,
|
||||
line = 37,
|
||||
line = 36,
|
||||
messageRegExp = "Unmapped target properties: \"auditTrail, primaryKey\"\\."),
|
||||
@Diagnostic(type = Erroneous1Mapper.class,
|
||||
kind = Kind.ERROR,
|
||||
line = 43,
|
||||
line = 42,
|
||||
messageRegExp = "More than one configuration prototype method is applicable. Use @InheritConfiguration"
|
||||
+ " to select one of them explicitly:"
|
||||
+ " .*BaseVehicleEntity baseDtoToEntity\\(.*BaseVehicleDto dto\\),"
|
||||
+ " .*BaseVehicleEntity anythingToEntity\\(java.lang.Object anyting\\)\\."),
|
||||
@Diagnostic(type = Erroneous1Mapper.class,
|
||||
kind = Kind.WARNING,
|
||||
line = 43,
|
||||
line = 42,
|
||||
messageRegExp = "Unmapped target property: \"primaryKey\"\\.")
|
||||
}
|
||||
)
|
||||
@ -202,7 +203,7 @@ public class InheritFromConfigTest {
|
||||
diagnostics = {
|
||||
@Diagnostic(type = Erroneous2Mapper.class,
|
||||
kind = Kind.ERROR,
|
||||
line = 39,
|
||||
line = 38,
|
||||
messageRegExp = "Cycle detected while evaluating inherited configurations. Inheritance path:"
|
||||
+ " .*CarEntity toCarEntity1\\(.*CarDto carDto\\)"
|
||||
+ " -> .*CarEntity toCarEntity2\\(.*CarDto carDto\\)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user