diff --git a/core-jdk8/src/main/java/org/mapstruct/Mapping.java b/core-jdk8/src/main/java/org/mapstruct/Mapping.java index 05e49d3ee..484e7f4fc 100644 --- a/core-jdk8/src/main/java/org/mapstruct/Mapping.java +++ b/core-jdk8/src/main/java/org/mapstruct/Mapping.java @@ -42,7 +42,7 @@ public @interface Mapping { *
* Either this attribute or {@link #source()} may be specified for a given mapping, but not both at the same time. * If this attribute is given, the target property must be specified via {@link #target()}. * - * @return A constant {@code String} expression specifying the value for the designated target prperty + * @return A constant {@code String} constant specifying the value for the designated target property */ - String expression() default ""; + String constant() default ""; } diff --git a/core/src/main/java/org/mapstruct/Mapping.java b/core/src/main/java/org/mapstruct/Mapping.java index c9f3e7a34..656775796 100644 --- a/core/src/main/java/org/mapstruct/Mapping.java +++ b/core/src/main/java/org/mapstruct/Mapping.java @@ -40,7 +40,7 @@ public @interface Mapping { *
* Either this attribute or {@link #source()} may be specified for a given mapping, but not both at the same time.
* If this attribute is given, the target property must be specified via {@link #target()}.
*
- * @return A constant {@code String} expression specifying the value for the designated target prperty
+ * @return A constant {@code String} constant specifying the value for the designated target property
*/
- String expression() default "";
+ String constant() default "";
}
diff --git a/processor/src/main/java/org/mapstruct/ap/model/source/Mapping.java b/processor/src/main/java/org/mapstruct/ap/model/source/Mapping.java
index 464e02f6e..0b55374a2 100644
--- a/processor/src/main/java/org/mapstruct/ap/model/source/Mapping.java
+++ b/processor/src/main/java/org/mapstruct/ap/model/source/Mapping.java
@@ -42,7 +42,7 @@ public class Mapping {
private final String sourceName;
private final String sourceParameterName;
private final String sourcePropertyName;
- private final String expression;
+ private final String constant;
private final String targetName;
private final String dateFormat;
private final AnnotationMirror mirror;
@@ -74,18 +74,18 @@ public class Mapping {
mappingPrism.values.source()
);
- if ( mappingPrism.source().isEmpty() && mappingPrism.expression().isEmpty() ) {
+ if ( mappingPrism.source().isEmpty() && mappingPrism.constant().isEmpty() ) {
messager.printMessage(
Diagnostic.Kind.ERROR,
- "Either define a source or an expression in a Mapping",
+ "Either define a source or a constant in a Mapping",
element
);
return null;
}
- else if ( !mappingPrism.source().isEmpty() && !mappingPrism.expression().isEmpty() ) {
+ else if ( !mappingPrism.source().isEmpty() && !mappingPrism.constant().isEmpty() ) {
messager.printMessage(
Diagnostic.Kind.ERROR,
- "Source and expression are both defined in Mapping, either define a source or an expression",
+ "Source and constant are both defined in Mapping, either define a source or an expression",
element
);
return null;
@@ -95,7 +95,7 @@ public class Mapping {
mappingPrism.source(),
sourceNameParts != null ? sourceNameParts[0] : null,
sourceNameParts != null ? sourceNameParts[1] : mappingPrism.source(),
- mappingPrism.expression(),
+ mappingPrism.constant(),
mappingPrism.target(),
mappingPrism.dateFormat(),
mappingPrism.mirror,
@@ -123,13 +123,13 @@ public class Mapping {
return parts;
}
- private Mapping(String sourceName, String sourceParameterName, String sourcePropertyName, String expression,
+ private Mapping(String sourceName, String sourceParameterName, String sourcePropertyName, String constant,
String targetName, String dateFormat, AnnotationMirror mirror,
AnnotationValue sourceAnnotationValue, AnnotationValue targetAnnotationValue) {
this.sourceName = sourceName;
this.sourceParameterName = sourceParameterName;
this.sourcePropertyName = sourcePropertyName;
- this.expression = expression;
+ this.constant = constant;
this.targetName = targetName.equals( "" ) ? sourceName : targetName;
this.dateFormat = dateFormat;
this.mirror = mirror;
@@ -165,8 +165,8 @@ public class Mapping {
return sourceParameterName;
}
- public String getExpression() {
- return expression;
+ public String getConstant() {
+ return constant;
}
@@ -193,13 +193,13 @@ public class Mapping {
public Mapping reverse() {
Mapping reverse = null;
- if ( expression != null ) {
+ if ( constant != null ) {
/* mapping can only be reversed if the source was not a constant */
reverse = new Mapping(
targetName,
null,
targetName,
- expression,
+ constant,
sourceName,
dateFormat,
mirror,
diff --git a/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java b/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java
index 0018fde78..5ed19ab1b 100644
--- a/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java
+++ b/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java
@@ -411,8 +411,8 @@ public class MapperCreationProcessor implements ModelElementProcessor