#271 Improving JavaDocs for @Mapping#expression()

This commit is contained in:
Gunnar Morling 2015-01-25 11:26:48 +01:00
parent d3de4991c9
commit 483b88c6d2
2 changed files with 42 additions and 12 deletions

View File

@ -92,14 +92,29 @@ public @interface Mapping {
String constant() default ""; String constant() default "";
/** /**
* An expression {@link String} based on which the specified target property is to be set. The format is determined * An expression {@link String} based on which the specified target property is to be set.
* by a type of expression. For instance: * <p>
* {@code expression = "java(new org.example.TimeAndFormat( s.getTime(), s.getFormat() ))")} will insert the java * Currently, Java is the only supported "expression language" and expressions must be given in form of Java
* expression in the designated {@link #target()} property. * expressions using the following format: {@code java(<EXPRESSION>)}. For instance the mapping
* <p> * <p>
* Either this attribute or {@link #source()} or {@link #constant()} may be specified for a given mapping.
* *
* @return A constant {@code String} constant specifying the value for the designated target property * <pre>
* {@code @Mapping(
* target = "someProp",
* expression = "java(new TimeAndFormat( s.getTime(), s.getFormat() ))"
* )}
* </pre>
* <p>
* will cause the following target property assignment to be generated:
* <p>
* {@code targetBean.setSomeProp( new TimeAndFormat( s.getTime(), s.getFormat() ) )}.
* <p>
* Any types referenced in expressions must be given via their fully-qualified name. Alternatively, types can be
* imported via {@link Mapper#imports()}.
* <p>
* Either this attribute, {@link #source()} or {@link #constant()} may be specified for a given mapping.
*
* @return An expression specifying the value for the designated target property
*/ */
String expression() default ""; String expression() default "";

View File

@ -90,14 +90,29 @@ public @interface Mapping {
String constant() default ""; String constant() default "";
/** /**
* An expression {@link String} based on which the specified target property is to be set. The format is determined * An expression {@link String} based on which the specified target property is to be set.
* by a type of expression. For instance: * <p>
* {@code expression = "java(new org.example.TimeAndFormat( s.getTime(), s.getFormat() ))")} will insert the java * Currently, Java is the only supported "expression language" and expressions must be given in form of Java
* expression in the designated {@link #target()} property. * expressions using the following format: {@code java(<EXPRESSION>)}. For instance the mapping
* <p> * <p>
* Either this attribute or {@link #source()} or {@link #constant()} may be specified for a given mapping.
* *
* @return A constant {@code String} constant specifying the value for the designated target property * <pre>
* {@code @Mapping(
* target = "someProp",
* expression = "java(new TimeAndFormat( s.getTime(), s.getFormat() ))"
* )}
* </pre>
* <p>
* will cause the following target property assignment to be generated:
* <p>
* {@code targetBean.setSomeProp( new TimeAndFormat( s.getTime(), s.getFormat() ) )}.
* <p>
* Any types referenced in expressions must be given via their fully-qualified name. Alternatively, types can be
* imported via {@link Mapper#imports()}.
* <p>
* Either this attribute, {@link #source()} or {@link #constant()} may be specified for a given mapping.
*
* @return An expression specifying the value for the designated target property
*/ */
String expression() default ""; String expression() default "";