#187 Improving JavaDoc, adding new attribute to JDK 8 version of @Mapping

This commit is contained in:
Gunnar Morling 2014-06-09 15:30:27 +02:00
parent 8804563a41
commit 75ef1f9f92
2 changed files with 30 additions and 7 deletions

View File

@ -37,12 +37,17 @@ import java.util.Date;
public @interface Mapping { public @interface Mapping {
/** /**
* The source name of the configured property as defined by the JavaBeans specification. If used to map an enum * The source to use for this Mapping. This can either be:
* constant, the name of the constant member is to be given. * <ol>
* <li>The source name of the configured property as defined by the JavaBeans specification.</li>
* <li>When used to map an enum constant, the name of the constant member is to be given<./li>.
* </ol>
* Either this attribute or {@link #expression()} may be specified for a given mapping, but not both at the same
* time.
* *
* @return The source name of the configured property or enum constant * @return The source name of the configured property or enum constant.
*/ */
String source(); String source() default "";
/** /**
* The target name of the configured property as defined by the JavaBeans specification. Defaults to the source name * The target name of the configured property as defined by the JavaBeans specification. Defaults to the source name
@ -59,4 +64,16 @@ public @interface Mapping {
* @return A date format string as processable by {@link SimpleDateFormat}. * @return A date format string as processable by {@link SimpleDateFormat}.
*/ */
String dateFormat() default ""; String dateFormat() default "";
/**
* A constant {@link String} expression 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.
* <p>
* 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
*/
String expression() default "";
} }

View File

@ -40,6 +40,8 @@ public @interface Mapping {
* <li>The source name of the configured property as defined by the JavaBeans specification.</li> * <li>The source name of the configured property as defined by the JavaBeans specification.</li>
* <li>When used to map an enum constant, the name of the constant member is to be given<./li>. * <li>When used to map an enum constant, the name of the constant member is to be given<./li>.
* </ol> * </ol>
* Either this attribute or {@link #expression()} may be specified for a given mapping, but not both at the same
* time.
* *
* @return The source name of the configured property or enum constant. * @return The source name of the configured property or enum constant.
*/ */
@ -62,10 +64,14 @@ public @interface Mapping {
String dateFormat() default ""; String dateFormat() default "";
/** /**
* {@link String} expression that uses available mappings and conversion to set the designated target property to * A constant {@link String} expression based on which the specified target property is to be set. If the designated
* the provided expression. * target property is not of type {@code String}, the value will be converted by applying a matching conversion
* method or built-in conversion.
* <p>
* 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 expression * @return A constant {@code String} expression specifying the value for the designated target prperty
*/ */
String expression() default ""; String expression() default "";
} }