mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#302 Formatting
This commit is contained in:
parent
b1e184811f
commit
e94acd56a4
@ -18,13 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.mapstruct.ap.model;
|
package org.mapstruct.ap.model;
|
||||||
|
|
||||||
import static org.mapstruct.ap.model.assignment.Assignment.AssignmentType.DIRECT;
|
|
||||||
import static org.mapstruct.ap.model.assignment.Assignment.AssignmentType.TYPE_CONVERTED;
|
|
||||||
import static org.mapstruct.ap.model.assignment.Assignment.AssignmentType.TYPE_CONVERTED_MAPPED;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.lang.model.element.ExecutableElement;
|
import javax.lang.model.element.ExecutableElement;
|
||||||
import javax.lang.model.type.TypeMirror;
|
import javax.lang.model.type.TypeMirror;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
@ -44,6 +39,10 @@ import org.mapstruct.ap.model.source.Mapping;
|
|||||||
import org.mapstruct.ap.model.source.SourceMethod;
|
import org.mapstruct.ap.model.source.SourceMethod;
|
||||||
import org.mapstruct.ap.util.Executables;
|
import org.mapstruct.ap.util.Executables;
|
||||||
|
|
||||||
|
import static org.mapstruct.ap.model.assignment.Assignment.AssignmentType.DIRECT;
|
||||||
|
import static org.mapstruct.ap.model.assignment.Assignment.AssignmentType.TYPE_CONVERTED;
|
||||||
|
import static org.mapstruct.ap.model.assignment.Assignment.AssignmentType.TYPE_CONVERTED_MAPPED;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the mapping between a source and target property, e.g. from
|
* Represents the mapping between a source and target property, e.g. from
|
||||||
@ -75,22 +74,22 @@ public class PropertyMapping extends ModelElement {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyMappingBuilder souceMethod( SourceMethod sourceMethod ) {
|
public PropertyMappingBuilder souceMethod(SourceMethod sourceMethod) {
|
||||||
this.method = sourceMethod;
|
this.method = sourceMethod;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyMappingBuilder targetAccessor( ExecutableElement targetAccessor ) {
|
public PropertyMappingBuilder targetAccessor(ExecutableElement targetAccessor) {
|
||||||
this.targetAccessor = targetAccessor;
|
this.targetAccessor = targetAccessor;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyMappingBuilder targetPropertyName( String targetPropertyName ) {
|
public PropertyMappingBuilder targetPropertyName(String targetPropertyName) {
|
||||||
this.targetPropertyName = targetPropertyName;
|
this.targetPropertyName = targetPropertyName;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyMappingBuilder parameter( Parameter parameter ) {
|
public PropertyMappingBuilder parameter(Parameter parameter) {
|
||||||
this.parameter = parameter;
|
this.parameter = parameter;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -140,9 +139,9 @@ public class PropertyMapping extends ModelElement {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PropertyMapping getPropertyMapping( ExecutableElement sourceAccessor,
|
private PropertyMapping getPropertyMapping(ExecutableElement sourceAccessor,
|
||||||
String dateFormat,
|
String dateFormat,
|
||||||
List<TypeMirror> qualifiers ) {
|
List<TypeMirror> qualifiers) {
|
||||||
|
|
||||||
Type sourceType;
|
Type sourceType;
|
||||||
Type targetType;
|
Type targetType;
|
||||||
@ -173,7 +172,8 @@ public class PropertyMapping extends ModelElement {
|
|||||||
String sourcePropertyName = Executables.getPropertyName( sourceAccessor );
|
String sourcePropertyName = Executables.getPropertyName( sourceAccessor );
|
||||||
String mappedElement = "property '" + sourcePropertyName + "'";
|
String mappedElement = "property '" + sourcePropertyName + "'";
|
||||||
|
|
||||||
Assignment assignment = ctx.getMappingResolver().getTargetAssignment( method,
|
Assignment assignment = ctx.getMappingResolver().getTargetAssignment(
|
||||||
|
method,
|
||||||
mappedElement,
|
mappedElement,
|
||||||
sourceType,
|
sourceType,
|
||||||
targetType,
|
targetType,
|
||||||
@ -286,7 +286,7 @@ public class PropertyMapping extends ModelElement {
|
|||||||
if ( sourceType.isCollectionType() && targetType.isCollectionType() ) {
|
if ( sourceType.isCollectionType() && targetType.isCollectionType() ) {
|
||||||
|
|
||||||
ForgedMethod methodToGenerate = new ForgedMethod( sourceType, targetType, element );
|
ForgedMethod methodToGenerate = new ForgedMethod( sourceType, targetType, element );
|
||||||
IterableMappingMethod.Builder builder = new IterableMappingMethod.Builder( );
|
IterableMappingMethod.Builder builder = new IterableMappingMethod.Builder();
|
||||||
|
|
||||||
|
|
||||||
IterableMappingMethod iterableMappingMethod = builder
|
IterableMappingMethod iterableMappingMethod = builder
|
||||||
@ -305,7 +305,7 @@ public class PropertyMapping extends ModelElement {
|
|||||||
|
|
||||||
ForgedMethod methodToGenerate = new ForgedMethod( sourceType, targetType, element );
|
ForgedMethod methodToGenerate = new ForgedMethod( sourceType, targetType, element );
|
||||||
|
|
||||||
MapMappingMethod.Builder builder = new MapMappingMethod.Builder( );
|
MapMappingMethod.Builder builder = new MapMappingMethod.Builder();
|
||||||
MapMappingMethod mapMappingMethod = builder
|
MapMappingMethod mapMappingMethod = builder
|
||||||
.mappingContext( ctx )
|
.mappingContext( ctx )
|
||||||
.method( methodToGenerate )
|
.method( methodToGenerate )
|
||||||
@ -335,27 +335,27 @@ public class PropertyMapping extends ModelElement {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantMappingBuilder sourceMethod( SourceMethod sourceMethod ) {
|
public ConstantMappingBuilder sourceMethod(SourceMethod sourceMethod) {
|
||||||
this.method = sourceMethod;
|
this.method = sourceMethod;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantMappingBuilder constantExpression( String constantExpression ) {
|
public ConstantMappingBuilder constantExpression(String constantExpression) {
|
||||||
this.constantExpression = constantExpression;
|
this.constantExpression = constantExpression;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantMappingBuilder targetAccessor( ExecutableElement targetAccessor ) {
|
public ConstantMappingBuilder targetAccessor(ExecutableElement targetAccessor) {
|
||||||
this.targetAccessor = targetAccessor;
|
this.targetAccessor = targetAccessor;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantMappingBuilder dateFormat( String dateFormat ) {
|
public ConstantMappingBuilder dateFormat(String dateFormat) {
|
||||||
this.dateFormat = dateFormat;
|
this.dateFormat = dateFormat;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantMappingBuilder qualifiers( List<TypeMirror> qualifiers ) {
|
public ConstantMappingBuilder qualifiers(List<TypeMirror> qualifiers) {
|
||||||
this.qualifiers = qualifiers;
|
this.qualifiers = qualifiers;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -377,7 +377,8 @@ public class PropertyMapping extends ModelElement {
|
|||||||
|
|
||||||
String targetPropertyName = Executables.getPropertyName( targetAccessor );
|
String targetPropertyName = Executables.getPropertyName( targetAccessor );
|
||||||
|
|
||||||
Assignment assignment = ctx.getMappingResolver().getTargetAssignment( method,
|
Assignment assignment = ctx.getMappingResolver().getTargetAssignment(
|
||||||
|
method,
|
||||||
mappedElement,
|
mappedElement,
|
||||||
sourceType,
|
sourceType,
|
||||||
targetType,
|
targetType,
|
||||||
@ -427,17 +428,17 @@ public class PropertyMapping extends ModelElement {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaExpressionMappingBuilder souceMethod( SourceMethod sourceMethod ) {
|
public JavaExpressionMappingBuilder souceMethod(SourceMethod sourceMethod) {
|
||||||
this.method = sourceMethod;
|
this.method = sourceMethod;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaExpressionMappingBuilder javaExpression( String javaExpression ) {
|
public JavaExpressionMappingBuilder javaExpression(String javaExpression) {
|
||||||
this.javaExpression = javaExpression;
|
this.javaExpression = javaExpression;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaExpressionMappingBuilder targetAccessor( ExecutableElement targetAccessor ) {
|
public JavaExpressionMappingBuilder targetAccessor(ExecutableElement targetAccessor) {
|
||||||
this.targetAccessor = targetAccessor;
|
this.targetAccessor = targetAccessor;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user