From ffb720dc29b62e26afda8b82ee5d8b7812278cd3 Mon Sep 17 00:00:00 2001 From: sjaakd Date: Sat, 28 Apr 2018 12:35:13 +0200 Subject: [PATCH] #1459 javadoc on constant assigment --- .../src/main/java/org/mapstruct/Mapping.java | 56 +++++++++++++++-- core/src/main/java/org/mapstruct/Mapping.java | 62 +++++++++++++++++-- 2 files changed, 106 insertions(+), 12 deletions(-) diff --git a/core-jdk8/src/main/java/org/mapstruct/Mapping.java b/core-jdk8/src/main/java/org/mapstruct/Mapping.java index f8a611abc..4064b7d86 100644 --- a/core-jdk8/src/main/java/org/mapstruct/Mapping.java +++ b/core-jdk8/src/main/java/org/mapstruct/Mapping.java @@ -94,9 +94,31 @@ public @interface Mapping { String numberFormat() default ""; /** - * A constant {@link String} based on which the specified target property is to be set. If the designated target - * property is not of type {@code String}, the value will be converted by applying a matching conversion method or - * built-in conversion. + * A constant {@link String} based on which the specified target property is to be set. + *

+ * When the designated target property is of type: + *

+ *
    + *
  1. primitive or boxed (e.g. {@code java.lang.Long}). + *

    + * MapStruct checks whether the primitive can be assigned as valid literal to the primitive or boxed type. + *

    + *
      + *
    • + * If possible, MapStruct assigns as literal. + *
    • + *
    • + * If not possible, MapStruct will try to apply a user defined mapping method. + *
    • + *
    + *
  2. + *
  3. other + *

    + * MapStruct handles the constant as {@code String}. The value will be converted by applying a matching method, + * type conversion method or built-in conversion. + *

    + *

  4. + *
*

* This attribute can not be used together with {@link #source()}, {@link #defaultValue()}, * {@link #defaultExpression()} or {@link #expression()}. @@ -214,9 +236,31 @@ public @interface Mapping { String[] dependsOn() default { }; /** - * In case the source property is {@code null}, the provided default {@link String} value is set. If the designated - * target property is not of type {@code String}, the value will be converted by applying a matching conversion - * method or built-in conversion. + * In case the source property is {@code null}, the provided default {@link String} value is set. + *

+ * When the designated target property is of type: + *

+ *
    + *
  1. primitive or boxed (e.g. {@code java.lang.Long}). + *

    + * MapStruct checks whether the primitive can be assigned as valid literal to the primitive or boxed type. + *

    + *
      + *
    • + * If possible, MapStruct assigns as literal. + *
    • + *
    • + * If not possible, MapStruct will try to apply a user defined mapping method. + *
    • + *
    + *
  2. + *
  3. other + *

    + * MapStruct handles the constant as {@code String}. The value will be converted by applying a matching method, + * type conversion method or built-in conversion. + *

    + *

  4. + *
*

* This attribute can not be used together with {@link #constant()}, {@link #expression()} * or {@link #defaultExpression()}. diff --git a/core/src/main/java/org/mapstruct/Mapping.java b/core/src/main/java/org/mapstruct/Mapping.java index 849e8bd87..86e1810e2 100644 --- a/core/src/main/java/org/mapstruct/Mapping.java +++ b/core/src/main/java/org/mapstruct/Mapping.java @@ -92,9 +92,34 @@ public @interface Mapping { String numberFormat() default ""; /** - * A constant {@link String} based on which the specified target property is to be set. If the designated target - * property is not of type {@code String}, the value will be converted by applying a matching conversion method or - * built-in conversion. + * A constant {@link String} based on which the specified target property is to be set. + *

+ * When the designated target property is of type: + *

+ *
    + *
  1. primitive or boxed (e.g. {@code java.lang.Long}). + *

    + * MapStruct checks whether the primitive can be assigned as valid literal to the primitive or boxed type. + *

    + *
      + *
    • + * If possible, MapStruct assigns as literal. + *
    • + *
    • + * If not possible, MapStruct will try to apply a user defined mapping method. + *
    • + *
    + *

    + * Please note that grouping underscores and binary literals are not supported in Java 6 + *

    + *
  2. + *
  3. other + *

    + * MapStruct handles the constant as {@code String}. The value will be converted by applying a matching method, + * type conversion method or built-in conversion. + *

    + *

  4. + *
*

* This attribute can not be used together with {@link #source()}, {@link #defaultValue()}, * {@link #defaultExpression()} or {@link #expression()}. @@ -213,9 +238,34 @@ public @interface Mapping { String[] dependsOn() default { }; /** - * In case the source property is {@code null}, the provided default {@link String} value is set. If the designated - * target property is not of type {@code String}, the value will be converted by applying a matching conversion - * method or built-in conversion. + * In case the source property is {@code null}, the provided default {@link String} value is set. + *

+ * When the designated target property is of type: + *

+ *
    + *
  1. primitive or boxed (e.g. {@code java.lang.Long}). + *

    + * MapStruct checks whether the primitive can be assigned as valid literal to the primitive or boxed type. + *

    + *
      + *
    • + * If possible, MapStruct assigns as literal. + *
    • + *
    • + * If not possible, MapStruct will try to apply a user defined mapping method. + *
    • + *
    + *

    + * Please note that grouping underscores and binary literals are not supported in Java 6 + *

    + *
  2. + *
  3. other + *

    + * MapStruct handles the constant as {@code String}. The value will be converted by applying a matching method, + * type conversion method or built-in conversion. + *

    + *

  4. + *
*

* This attribute can not be used together with {@link #constant()}, {@link #expression()} * or {@link #defaultExpression()}.