mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#242 Fixing typo; Formatting
This commit is contained in:
parent
5af39aa4a0
commit
a9a93b97c8
@ -416,12 +416,12 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
// check constants first
|
||||
if ( !mapping.getConstant().isEmpty() ) {
|
||||
return getConstantMapping(
|
||||
mapperReferences,
|
||||
methods,
|
||||
method,
|
||||
"\"" + mapping.getConstant() + "\"",
|
||||
targetAccessor,
|
||||
dateFormat
|
||||
mapperReferences,
|
||||
methods,
|
||||
method,
|
||||
"\"" + mapping.getConstant() + "\"",
|
||||
targetAccessor,
|
||||
dateFormat
|
||||
);
|
||||
}
|
||||
|
||||
@ -681,7 +681,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
|
||||
}
|
||||
else if ( mappedProperty.getConstant().isEmpty() &&
|
||||
mappedProperty.getJavaExpression().isEmpty() &&
|
||||
mappedProperty.getJavaExpression().isEmpty() &&
|
||||
!hasSourceProperty( method, mappedProperty.getSourcePropertyName() ) ) {
|
||||
messager.printMessage(
|
||||
Kind.ERROR,
|
||||
@ -809,8 +809,8 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
assignment = new SetterWrapper( assignment, method.getThrownTypes() );
|
||||
if ( !sourceType.isPrimitive() &&
|
||||
( assignment.getType() == TYPE_CONVERTED ||
|
||||
assignment.getType() == TYPE_CONVERTED_MAPPED ||
|
||||
assignment.getType() == DIRECT && targetType.isPrimitive() ) ) {
|
||||
assignment.getType() == TYPE_CONVERTED_MAPPED ||
|
||||
assignment.getType() == DIRECT && targetType.isPrimitive() ) ) {
|
||||
// for primitive types null check is not possible at all, but a conversion needs
|
||||
// a null check.
|
||||
assignment = new NullCheckWrapper( assignment );
|
||||
@ -820,7 +820,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
// TargetAccessorType must be ADDER
|
||||
if ( sourceIsCollection ) {
|
||||
assignment =
|
||||
new AdderWrapper( assignment, method.getThrownTypes(), sourceReference, sourceType );
|
||||
new AdderWrapper( assignment, method.getThrownTypes(), sourceReference, sourceType );
|
||||
}
|
||||
else {
|
||||
// Possibly adding null to a target collection. So should be surrounded by an null check.
|
||||
@ -912,7 +912,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
String javaExpression,
|
||||
ExecutableElement targetAcessor) {
|
||||
|
||||
Type targetType = typeFactory.getSingleParameter( targetAcessor ).getType();
|
||||
Type targetType = typeFactory.getSingleParameter( targetAcessor ).getType();
|
||||
Assignment assignment = AssignmentFactory.createSimple( javaExpression );
|
||||
assignment = new SetterWrapper( assignment, method.getThrownTypes() );
|
||||
return new PropertyMapping( targetAcessor.getSimpleName().toString(), targetType, assignment );
|
||||
|
@ -23,6 +23,7 @@ import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mapstruct.ap.test.collection.adder.source.SingleElementSource;
|
||||
import org.mapstruct.ap.test.collection.adder.source.Source;
|
||||
import org.mapstruct.ap.test.collection.adder.source.SourceTeeth;
|
||||
import org.mapstruct.ap.test.collection.adder.target.AdderUsageObserver;
|
||||
@ -35,14 +36,13 @@ import org.mapstruct.ap.test.collection.adder.target.TargetHuman;
|
||||
import org.mapstruct.ap.test.collection.adder.target.TargetOnlyGetter;
|
||||
import org.mapstruct.ap.test.collection.adder.target.TargetViaTargetType;
|
||||
import org.mapstruct.ap.test.collection.adder.target.TargetWithoutSetter;
|
||||
import org.mapstruct.ap.testutil.IssueKey;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.mapstruct.ap.test.collection.adder.source.SingleElementSource;
|
||||
import org.mapstruct.ap.testutil.IssueKey;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
@ -227,7 +227,7 @@ public class AdderTest {
|
||||
|
||||
@IssueKey("242")
|
||||
@Test
|
||||
public void testSingleElemtSource() throws DogException {
|
||||
public void testSingleElementSource() throws DogException {
|
||||
AdderUsageObserver.setUsed( false );
|
||||
|
||||
SingleElementSource source = new SingleElementSource();
|
||||
@ -239,5 +239,4 @@ public class AdderTest {
|
||||
assertThat( target.getPets().get( 0 ) ).isEqualTo( 2L );
|
||||
assertTrue( AdderUsageObserver.isUsed() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class SingleElementSource {
|
||||
return pet;
|
||||
}
|
||||
|
||||
public void setPet( String pet ) {
|
||||
public void setPet(String pet) {
|
||||
this.pet = pet;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user