mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#330 Formatting
This commit is contained in:
parent
9ea7f96b9c
commit
b560b953cf
@ -20,7 +20,6 @@ package org.mapstruct.ap.model;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
|
|
||||||
import org.mapstruct.ap.model.common.Parameter;
|
import org.mapstruct.ap.model.common.Parameter;
|
||||||
@ -74,8 +73,11 @@ public class EnumMappingMethod extends MappingMethod {
|
|||||||
enumMappings.add( new EnumMapping( enumConstant, enumConstant ) );
|
enumMappings.add( new EnumMapping( enumConstant, enumConstant ) );
|
||||||
}
|
}
|
||||||
else if ( mappedConstants.size() == 1 ) {
|
else if ( mappedConstants.size() == 1 ) {
|
||||||
enumMappings.add( new EnumMapping(
|
enumMappings.add(
|
||||||
enumConstant, mappedConstants.iterator().next().getTargetName() ) );
|
new EnumMapping(
|
||||||
|
enumConstant, mappedConstants.iterator().next().getTargetName()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
List<String> targetConstants = new ArrayList<String>( mappedConstants.size() );
|
List<String> targetConstants = new ArrayList<String>( mappedConstants.size() );
|
||||||
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.lang.model.element.ExecutableElement;
|
import javax.lang.model.element.ExecutableElement;
|
||||||
import javax.lang.model.element.Modifier;
|
import javax.lang.model.element.Modifier;
|
||||||
import javax.lang.model.util.Types;
|
import javax.lang.model.util.Types;
|
||||||
@ -76,7 +75,8 @@ public class SourceMethod implements Method {
|
|||||||
mappings,
|
mappings,
|
||||||
iterableMapping,
|
iterableMapping,
|
||||||
mapMapping,
|
mapMapping,
|
||||||
typeUtils );
|
typeUtils
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SourceMethod forReferencedMethod(Type declaringMapper, ExecutableElement executable,
|
public static SourceMethod forReferencedMethod(Type declaringMapper, ExecutableElement executable,
|
||||||
@ -92,7 +92,8 @@ public class SourceMethod implements Method {
|
|||||||
Collections.<String, List<Mapping>>emptyMap(),
|
Collections.<String, List<Mapping>>emptyMap(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
typeUtils );
|
typeUtils
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SourceMethod forFactoryMethod(Type declaringMapper, ExecutableElement executable, Type returnType,
|
public static SourceMethod forFactoryMethod(Type declaringMapper, ExecutableElement executable, Type returnType,
|
||||||
@ -107,7 +108,8 @@ public class SourceMethod implements Method {
|
|||||||
Collections.<String, List<Mapping>>emptyMap(),
|
Collections.<String, List<Mapping>>emptyMap(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
typeUtils );
|
typeUtils
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SourceMethod(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters,
|
private SourceMethod(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters,
|
||||||
@ -352,6 +354,7 @@ public class SourceMethod implements Method {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parameters the parameter list to check
|
* @param parameters the parameter list to check
|
||||||
|
*
|
||||||
* @return <code>true</code>, iff the parameter list contains a parameter annotated with {@code @TargetType}
|
* @return <code>true</code>, iff the parameter list contains a parameter annotated with {@code @TargetType}
|
||||||
*/
|
*/
|
||||||
public static boolean containsTargetTypeParameter(List<Parameter> parameters) {
|
public static boolean containsTargetTypeParameter(List<Parameter> parameters) {
|
||||||
|
@ -18,13 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.mapstruct.ap.test.source.constants;
|
package org.mapstruct.ap.test.source.constants;
|
||||||
|
|
||||||
import static org.fest.assertions.Assertions.assertThat;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.tools.Diagnostic.Kind;
|
import javax.tools.Diagnostic.Kind;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -36,6 +33,8 @@ import org.mapstruct.ap.testutil.compilation.annotation.Diagnostic;
|
|||||||
import org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome;
|
import org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome;
|
||||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||||
|
|
||||||
|
import static org.fest.assertions.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sjaak Derksen
|
* @author Sjaak Derksen
|
||||||
*/
|
*/
|
||||||
@ -124,7 +123,8 @@ public class SourceConstantsTest {
|
|||||||
@Diagnostic(type = ErroneousMapper3.class,
|
@Diagnostic(type = ErroneousMapper3.class,
|
||||||
kind = Kind.ERROR,
|
kind = Kind.ERROR,
|
||||||
line = 41,
|
line = 41,
|
||||||
messageRegExp = "Expression and constant are both defined in @Mapping, either define an expression or a "
|
messageRegExp =
|
||||||
|
"Expression and constant are both defined in @Mapping, either define an expression or a "
|
||||||
+ "constant"),
|
+ "constant"),
|
||||||
@Diagnostic(type = ErroneousMapper3.class,
|
@Diagnostic(type = ErroneousMapper3.class,
|
||||||
kind = Kind.WARNING,
|
kind = Kind.WARNING,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user