mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#1301 Use Java 8 as baseline for MapStruct
* Move classes from mapstruct-common into mapstruct * Use Java 8 @Repeatable for @Mappings and @ValueMappings in the mapstruct module * Add relocation for mapstruct-jdk8 to mapstruct * Use of 1.8 source and target versions from parent POM * Update documentation to match * Update versions of some maven plugin crashing build on Java 8 * Drop JDK 6 & 7 support in integration tests * Remove mapstruct-common module (it was never deployed to Central)
This commit is contained in:
parent
20bff96e99
commit
d81d3e46a4
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright MapStruct Authors.
|
||||
|
||||
Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-parent</artifactId>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>mapstruct-common</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>MapStruct Core Common</name>
|
||||
|
||||
<properties>
|
||||
<maven.javadoc.skip>true</maven.javadoc.skip>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>check-style</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>checkstyle</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -17,146 +17,13 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>MapStruct Core JDK 8</name>
|
||||
<description>MapStruct annotations to be used with JDK 8 and later</description>
|
||||
<description>Deprecated MapStruct artifact containing annotations to be used with JDK 8 and later -
|
||||
Relocated to mapstruct</description>
|
||||
<distributionManagement>
|
||||
<relocation>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
</relocation>
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<common.sources.dir>copied-common-sources</common.sources.dir>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mapstruct-common</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>check-style</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>checkstyle</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-copied-common-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.build.directory}/${common.sources.dir}</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/${common.sources.dir}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/../core-common/src/main/java</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-mapstruct-license</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/classes/META-INF</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/..</directory>
|
||||
<filtering>false</filtering>
|
||||
<include>LICENSE.txt</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Automatic-Module-Name>org.mapstruct</Automatic-Module-Name>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.siom79.japicmp</groupId>
|
||||
<artifactId>japicmp-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -1,270 +0,0 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.mapstruct.NullValueCheckStrategy.ON_IMPLICIT_CONVERSION;
|
||||
|
||||
/**
|
||||
* Configures the mapping of one bean attribute or enum constant.
|
||||
* <p>
|
||||
* The name of the mapped attribute or constant is to be specified via {@link #target()}. For mapped bean attributes it
|
||||
* is assumed by default that the attribute has the same name in the source bean. Alternatively, one of
|
||||
* {@link #source()}, {@link #expression()} or {@link #constant()} can be specified to define the property source.
|
||||
* <p>
|
||||
* In addition, the attributes {@link #dateFormat()} and {@link #qualifiedBy()} may be used to further define the
|
||||
* mapping.
|
||||
*
|
||||
* <p>
|
||||
* <b>IMPORTANT NOTE:</b> the enum mapping capability is deprecated and replaced by {@link ValueMapping} it
|
||||
* will be removed in subsequent versions.
|
||||
*
|
||||
* @author Gunnar Morling
|
||||
*/
|
||||
@Repeatable(Mappings.class)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Mapping {
|
||||
|
||||
/**
|
||||
* The target name of the configured property as defined by the JavaBeans specification. The same target property
|
||||
* must not be mapped more than once.
|
||||
* <p>
|
||||
* If used to map an enum constant, the name of the constant member is to be given. In this case, several values
|
||||
* from the source enum may be mapped to the same value of the target enum.
|
||||
*
|
||||
* @return The target name of the configured property or enum constant
|
||||
*/
|
||||
String target();
|
||||
|
||||
/**
|
||||
* The source to use for this mapping. This can either be:
|
||||
* <ol>
|
||||
* <li>The source name of the configured property as defined by the JavaBeans specification.
|
||||
* <p>
|
||||
* This may either be a simple property name (e.g. "address") or a dot-separated property path (e.g. "address.city"
|
||||
* or "address.city.name"). In case the annotated method has several source parameters, the property name must
|
||||
* qualified with the parameter name, e.g. "addressParam.city".</li>
|
||||
* <li>When no matching property is found, MapStruct looks for a matching parameter name instead.</li>
|
||||
* <li>When used to map an enum constant, the name of the constant member is to be given.</li>
|
||||
* </ol>
|
||||
* This attribute can not be used together with {@link #constant()} or {@link #expression()}.
|
||||
*
|
||||
* @return The source name of the configured property or enum constant.
|
||||
*/
|
||||
String source() default "";
|
||||
|
||||
/**
|
||||
* A format string as processable by {@link SimpleDateFormat} if the attribute is mapped from {@code String} to
|
||||
* {@link Date} or vice-versa. Will be ignored for all other attribute types and when mapping enum constants.
|
||||
*
|
||||
* @return A date format string as processable by {@link SimpleDateFormat}.
|
||||
*/
|
||||
String dateFormat() default "";
|
||||
|
||||
/**
|
||||
* A format string as processable by {@link DecimalFormat} if the annotated method maps from a
|
||||
* {@link Number} to a {@link String} or vice-versa. Will be ignored for all other element types.
|
||||
*
|
||||
* @return A decimal format string as processable by {@link DecimalFormat}.
|
||||
*/
|
||||
String numberFormat() default "";
|
||||
|
||||
/**
|
||||
* A constant {@link String} based on which the specified target property is to be set.
|
||||
* <p>
|
||||
* When the designated target property is of type:
|
||||
* </p>
|
||||
* <ol>
|
||||
* <li>primitive or boxed (e.g. {@code java.lang.Long}).
|
||||
* <p>
|
||||
* MapStruct checks whether the primitive can be assigned as valid literal to the primitive or boxed type.
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>
|
||||
* If possible, MapStruct assigns as literal.
|
||||
* </li>
|
||||
* <li>
|
||||
* If not possible, MapStruct will try to apply a user defined mapping method.
|
||||
* </li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>other
|
||||
* <p>
|
||||
* MapStruct handles the constant as {@code String}. The value will be converted by applying a matching method,
|
||||
* type conversion method or built-in conversion.
|
||||
* <p>
|
||||
* </li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* This attribute can not be used together with {@link #source()}, {@link #defaultValue()},
|
||||
* {@link #defaultExpression()} or {@link #expression()}.
|
||||
*
|
||||
* @return A constant {@code String} constant specifying the value for the designated target property
|
||||
*/
|
||||
String constant() default "";
|
||||
|
||||
/**
|
||||
* An expression {@link String} based on which the specified target property is to be set.
|
||||
* <p>
|
||||
* Currently, Java is the only supported "expression language" and expressions must be given in form of Java
|
||||
* expressions using the following format: {@code java(<EXPRESSION>)}. For instance the mapping:
|
||||
* <pre><code>
|
||||
* @Mapping(
|
||||
* target = "someProp",
|
||||
* expression = "java(new TimeAndFormat( s.getTime(), s.getFormat() ))"
|
||||
* )
|
||||
* </code></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>
|
||||
* This attribute can not be used together with {@link #source()}, {@link #defaultValue()},
|
||||
* {@link #defaultExpression()} or {@link #constant()}.
|
||||
*
|
||||
* @return An expression specifying the value for the designated target property
|
||||
*/
|
||||
String expression() default "";
|
||||
|
||||
/**
|
||||
* A defaultExpression {@link String} based on which the specified target property is to be set
|
||||
* if and only if the specified source property is null.
|
||||
* <p>
|
||||
* Currently, Java is the only supported "expression language" and expressions must be given in form of Java
|
||||
* expressions using the following format: {@code java(<EXPRESSION>)}. For instance the mapping:
|
||||
* <pre><code>
|
||||
* @Mapping(
|
||||
* target = "someProp",
|
||||
* defaultExpression = "java(new TimeAndFormat( s.getTime(), s.getFormat() ))"
|
||||
* )
|
||||
* </code></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>
|
||||
* This attribute can not be used together with {@link #expression()}, {@link #defaultValue()}
|
||||
* or {@link #constant()}.
|
||||
*
|
||||
* @return An expression specifying a defaultValue for the designated target property if the designated source
|
||||
* property is null
|
||||
*
|
||||
* @since 1.3
|
||||
*/
|
||||
String defaultExpression() default "";
|
||||
|
||||
/**
|
||||
* Whether the property specified via {@link #target()} should be ignored by the generated mapping method or not.
|
||||
* This can be useful when certain attributes should not be propagated from source or target or when properties in
|
||||
* the target object are populated using a decorator and thus would be reported as unmapped target property by
|
||||
* default.
|
||||
*
|
||||
* @return {@code true} if the given property should be ignored, {@code false} otherwise
|
||||
*/
|
||||
boolean ignore() default false;
|
||||
|
||||
/**
|
||||
* A qualifier can be specified to aid the selection process of a suitable mapper. This is useful in case multiple
|
||||
* mapping methods (hand written or generated) qualify and thus would result in an 'Ambiguous mapping methods found'
|
||||
* error. A qualifier is a custom annotation and can be placed on a hand written mapper class or a method.
|
||||
*
|
||||
* @return the qualifiers
|
||||
*/
|
||||
Class<? extends Annotation>[] qualifiedBy() default { };
|
||||
|
||||
/**
|
||||
* String-based form of qualifiers; When looking for a suitable mapping method for a given property, MapStruct will
|
||||
* only consider those methods carrying directly or indirectly (i.e. on the class-level) a {@link Named} annotation
|
||||
* for each of the specified qualifier names.
|
||||
* <p>
|
||||
* Note that annotation-based qualifiers are generally preferable as they allow more easily to find references and
|
||||
* are safe for refactorings, but name-based qualifiers can be a less verbose alternative when requiring a large
|
||||
* number of qualifiers as no custom annotation types are needed.
|
||||
*
|
||||
* @return One or more qualifier name(s)
|
||||
* @see #qualifiedBy()
|
||||
* @see Named
|
||||
*/
|
||||
String[] qualifiedByName() default { };
|
||||
|
||||
/**
|
||||
* Specifies the result type of the mapping method to be used in case multiple mapping methods qualify.
|
||||
*
|
||||
* @return the resultType to select
|
||||
*/
|
||||
Class<?> resultType() default void.class;
|
||||
|
||||
/**
|
||||
* One or more properties of the result type on which the mapped property depends. The generated method
|
||||
* implementation will invoke the setters of the result type ordered so that the given dependency relationship(s)
|
||||
* are satisfied. Useful in case one property setter depends on the state of another property of the result type.
|
||||
* <p>
|
||||
* An error will be raised in case a cycle in the dependency relationships is detected.
|
||||
*
|
||||
* @return the dependencies of the mapped property
|
||||
*/
|
||||
String[] dependsOn() default { };
|
||||
|
||||
/**
|
||||
* In case the source property is {@code null}, the provided default {@link String} value is set.
|
||||
* <p>
|
||||
* When the designated target property is of type:
|
||||
* </p>
|
||||
* <ol>
|
||||
* <li>primitive or boxed (e.g. {@code java.lang.Long}).
|
||||
* <p>
|
||||
* MapStruct checks whether the primitive can be assigned as valid literal to the primitive or boxed type.
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>
|
||||
* If possible, MapStruct assigns as literal.
|
||||
* </li>
|
||||
* <li>
|
||||
* If not possible, MapStruct will try to apply a user defined mapping method.
|
||||
* </li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>other
|
||||
* <p>
|
||||
* MapStruct handles the constant as {@code String}. The value will be converted by applying a matching method,
|
||||
* type conversion method or built-in conversion.
|
||||
* <p>
|
||||
* </li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* This attribute can not be used together with {@link #constant()}, {@link #expression()}
|
||||
* or {@link #defaultExpression()}.
|
||||
*
|
||||
* @return Default value to set in case the source property is {@code null}.
|
||||
*/
|
||||
String defaultValue() default "";
|
||||
|
||||
/**
|
||||
* Determines when to include a null check on the source property value of a bean mapping.
|
||||
*
|
||||
* Can be overridden by the one on {@link MapperConfig}, {@link Mapper} or {@link BeanMapping}.
|
||||
*
|
||||
* @return strategy how to do null checking
|
||||
*/
|
||||
NullValueCheckStrategy nullValueCheckStrategy() default ON_IMPLICIT_CONVERSION;
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Configures the mappings of several bean attributes.
|
||||
*
|
||||
* @author Gunnar Morling
|
||||
*/
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Mappings {
|
||||
|
||||
/**
|
||||
* The configuration of the bean attributes.
|
||||
*
|
||||
* @return The configuration of the bean attributes.
|
||||
*/
|
||||
Mapping[] value();
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Configures the mapping of source constant value to target constant value.
|
||||
* <p>
|
||||
* Supported mappings are
|
||||
* <ol>
|
||||
* <li>Enumeration to Enumeration</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* <B>Example 1:</B>
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* public enum OrderType { RETAIL, B2B, EXTRA, STANDARD, NORMAL }
|
||||
*
|
||||
* public enum ExternalOrderType { RETAIL, B2B, SPECIAL, DEFAULT }
|
||||
*
|
||||
* @ValueMapping(source = "EXTRA", target = "SPECIAL"),
|
||||
* @ValueMapping(source = "STANDARD", target = "DEFAULT"),
|
||||
* @ValueMapping(source = "NORMAL", target = "DEFAULT")
|
||||
* ExternalOrderType orderTypeToExternalOrderType(OrderType orderType);
|
||||
* </code>
|
||||
* Mapping result:
|
||||
* +---------------------+----------------------------+
|
||||
* | OrderType | ExternalOrderType |
|
||||
* +---------------------+----------------------------+
|
||||
* | null | null |
|
||||
* | OrderType.EXTRA | ExternalOrderType.SPECIAL |
|
||||
* | OrderType.STANDARD | ExternalOrderType.DEFAULT |
|
||||
* | OrderType.NORMAL | ExternalOrderType.DEFAULT |
|
||||
* | OrderType.RETAIL | ExternalOrderType.RETAIL |
|
||||
* | OrderType.B2B | ExternalOrderType.B2B |
|
||||
* +---------------------+----------------------------+
|
||||
* </pre>
|
||||
*
|
||||
* MapStruct will <B>WARN</B> on incomplete mappings. However, if for some reason no match is found an
|
||||
* {@link java.lang.IllegalStateException} will be thrown.
|
||||
* <p>
|
||||
* <B>Example 2:</B>
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* @ValueMapping( source = MappingConstants.NULL, target = "DEFAULT" ),
|
||||
* @ValueMapping( source = "STANDARD", target = MappingConstants.NULL ),
|
||||
* @ValueMapping( source = MappingConstants.ANY_REMAINING, target = "SPECIAL" )
|
||||
* ExternalOrderType orderTypeToExternalOrderType(OrderType orderType);
|
||||
* </code>
|
||||
* Mapping result:
|
||||
* +---------------------+----------------------------+
|
||||
* | OrderType | ExternalOrderType |
|
||||
* +---------------------+----------------------------+
|
||||
* | null | ExternalOrderType.DEFAULT |
|
||||
* | OrderType.STANDARD | null |
|
||||
* | OrderType.RETAIL | ExternalOrderType.RETAIL |
|
||||
* | OrderType.B2B | ExternalOrderType.B2B |
|
||||
* | OrderType.NORMAL | ExternalOrderType.SPECIAL |
|
||||
* | OrderType.EXTRA | ExternalOrderType.SPECIAL |
|
||||
* +---------------------+----------------------------+
|
||||
* </pre>
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Repeatable(ValueMappings.class)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface ValueMapping {
|
||||
/**
|
||||
* The source value constant to use for this mapping.
|
||||
*
|
||||
* <p>
|
||||
* <b>Valid values:</b>
|
||||
* <ol>
|
||||
* <li>enum constant name</li>
|
||||
* <li>{@link MappingConstants#NULL}</li>
|
||||
* <li>{@link MappingConstants#ANY_REMAINING}</li>
|
||||
* <li>{@link MappingConstants#ANY_UNMAPPED}</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* <b>NOTE:</b>When using <ANY_REMAINING>, MapStruct will perform the normal name based mapping, in which
|
||||
* source is mapped to target based on enum identifier equality. Using <ANY_UNMAPPED> will not apply name
|
||||
* based mapping.
|
||||
*
|
||||
* @return The source value.
|
||||
*/
|
||||
String source();
|
||||
|
||||
/**
|
||||
* The target value constant to use for this mapping.
|
||||
*
|
||||
* <p>
|
||||
* <b>Valid values:</b>
|
||||
* <ol>
|
||||
* <li>enum constant name</li>
|
||||
* <li>{@link MappingConstants#NULL}</li>
|
||||
* </ol>
|
||||
*
|
||||
* @return The target value.
|
||||
*/
|
||||
String target();
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright MapStruct Authors.
|
||||
*
|
||||
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
package org.mapstruct;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Constructs a set of value (constant) mappings.
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface ValueMappings {
|
||||
|
||||
ValueMapping[] value();
|
||||
|
||||
}
|
38
core/pom.xml
38
core/pom.xml
@ -20,10 +20,6 @@
|
||||
<packaging>jar</packaging>
|
||||
<name>MapStruct Core</name>
|
||||
|
||||
<properties>
|
||||
<common.sources.dir>copied-common-sources</common.sources.dir>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
@ -70,44 +66,10 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-copied-common-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.build.directory}/${common.sources.dir}</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/${common.sources.dir}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/../core-common/src/main/java</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-mapstruct-license</id>
|
||||
<phase>prepare-package</phase>
|
||||
|
@ -7,15 +7,15 @@ package org.mapstruct;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.mapstruct.NullValueCheckStrategy.ON_IMPLICIT_CONVERSION;
|
||||
|
||||
/**
|
||||
* Configures the mapping of one bean attribute or enum constant.
|
||||
* <p>
|
||||
@ -32,6 +32,8 @@ import static org.mapstruct.NullValueCheckStrategy.ON_IMPLICIT_CONVERSION;
|
||||
*
|
||||
* @author Gunnar Morling
|
||||
*/
|
||||
|
||||
@Repeatable(Mappings.class)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Mapping {
|
||||
@ -98,9 +100,6 @@ public @interface Mapping {
|
||||
* If not possible, MapStruct will try to apply a user defined mapping method.
|
||||
* </li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* Please note that grouping underscores and binary literals are not supported in Java 6
|
||||
* </p>
|
||||
* </li>
|
||||
* <li>other
|
||||
* <p>
|
||||
@ -207,7 +206,6 @@ public @interface Mapping {
|
||||
*/
|
||||
String[] qualifiedByName() default { };
|
||||
|
||||
|
||||
/**
|
||||
* Specifies the result type of the mapping method to be used in case multiple mapping methods qualify.
|
||||
*
|
||||
@ -244,9 +242,6 @@ public @interface Mapping {
|
||||
* If not possible, MapStruct will try to apply a user defined mapping method.
|
||||
* </li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* Please note that grouping underscores and binary literals are not supported in Java 6
|
||||
* </p>
|
||||
* </li>
|
||||
* <li>other
|
||||
* <p>
|
||||
|
@ -6,6 +6,7 @@
|
||||
package org.mapstruct;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
@ -26,11 +27,9 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* public enum ExternalOrderType { RETAIL, B2B, SPECIAL, DEFAULT }
|
||||
*
|
||||
* @ValueMappings({
|
||||
* @ValueMapping(source = "EXTRA", target = "SPECIAL"),
|
||||
* @ValueMapping(source = "STANDARD", target = "DEFAULT"),
|
||||
* @ValueMapping(source = "NORMAL", target = "DEFAULT")
|
||||
* })
|
||||
* @ValueMapping(source = "EXTRA", target = "SPECIAL"),
|
||||
* @ValueMapping(source = "STANDARD", target = "DEFAULT"),
|
||||
* @ValueMapping(source = "NORMAL", target = "DEFAULT")
|
||||
* ExternalOrderType orderTypeToExternalOrderType(OrderType orderType);
|
||||
* </code>
|
||||
* Mapping result:
|
||||
@ -53,11 +52,9 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* @ValueMappings({
|
||||
* @ValueMapping( source = MappingConstants.NULL, target = "DEFAULT" ),
|
||||
* @ValueMapping( source = "STANDARD", target = MappingConstants.NULL ),
|
||||
* @ValueMapping( source = MappingConstants.ANY_REMAINING, target = "SPECIAL" )
|
||||
* })
|
||||
* @ValueMapping( source = MappingConstants.NULL, target = "DEFAULT" ),
|
||||
* @ValueMapping( source = "STANDARD", target = MappingConstants.NULL ),
|
||||
* @ValueMapping( source = MappingConstants.ANY_REMAINING, target = "SPECIAL" )
|
||||
* ExternalOrderType orderTypeToExternalOrderType(OrderType orderType);
|
||||
* </code>
|
||||
* Mapping result:
|
||||
@ -75,10 +72,10 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Repeatable(ValueMappings.class)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface ValueMapping {
|
||||
|
||||
/**
|
||||
* The source value constant to use for this mapping.
|
||||
*
|
||||
|
@ -25,10 +25,6 @@
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
@ -82,7 +78,6 @@
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<sourcepath>
|
||||
${basedir}/../core-common/src/main/java;
|
||||
${basedir}/../core/src/main/java;
|
||||
${basedir}/../processor/src/main/java
|
||||
</sourcepath>
|
||||
|
@ -19,7 +19,6 @@
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<includes>
|
||||
<include>org.mapstruct:mapstruct</include>
|
||||
<include>org.mapstruct:mapstruct-jdk8</include>
|
||||
<include>org.mapstruct:mapstruct-processor</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
|
@ -44,7 +44,7 @@ MapStruct is a Java annotation processor based on http://www.jcp.org/en/jsr/deta
|
||||
|
||||
It comprises the following artifacts:
|
||||
|
||||
* _org.mapstruct:mapstruct_: contains the required annotations such as `@Mapping`; On Java 8 or later, use _org.mapstruct:mapstruct-jdk8_ instead which takes advantage of language improvements introduced in Java 8
|
||||
* _org.mapstruct:mapstruct_: contains the required annotations such as `@Mapping`
|
||||
* _org.mapstruct:mapstruct-processor_: contains the annotation processor which generates mapper implementations
|
||||
|
||||
=== Apache Maven
|
||||
@ -64,7 +64,7 @@ For Maven based projects add the following to your POM file in order to use MapS
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@ -107,7 +107,7 @@ If the processor is not kicking in, check that the configuration of annotation p
|
||||
To do so, go to "Preferences" -> "Maven" -> "Annotation Processing" and select "Automatically configure JDT APT".
|
||||
Alternatively, specify the following in the `properties` section of your POM file: `<m2e.apt.activation>jdt_apt</m2e.apt.activation>`.
|
||||
|
||||
Also make sure that your project is using Java 1.6 or later (project properties -> "Java Compiler" -> "Compile Compliance Level").
|
||||
Also make sure that your project is using Java 1.8 or later (project properties -> "Java Compiler" -> "Compile Compliance Level").
|
||||
It will not work with older versions.
|
||||
====
|
||||
|
||||
@ -133,7 +133,7 @@ apply plugin: 'net.ltgt.apt-eclipse'
|
||||
|
||||
dependencies {
|
||||
...
|
||||
compile "org.mapstruct:mapstruct-jdk8:${mapstructVersion}"
|
||||
compile "org.mapstruct:mapstruct:${mapstructVersion}"
|
||||
|
||||
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
|
||||
// If you are using mapstruct in test code
|
||||
@ -159,7 +159,7 @@ Add the `javac` task configured as follows to your _build.xml_ file in order to
|
||||
<javac
|
||||
srcdir="src/main/java"
|
||||
destdir="target/classes"
|
||||
classpath="path/to/mapstruct-jdk8-{mapstructVersion}.jar">
|
||||
classpath="path/to/mapstruct-{mapstructVersion}.jar">
|
||||
<compilerarg line="-processorpath path/to/mapstruct-processor-{mapstructVersion}.jar"/>
|
||||
<compilerarg line="-s target/generated-sources"/>
|
||||
</javac>
|
||||
@ -347,10 +347,6 @@ public Builder seatCount(int seatCount) {
|
||||
```
|
||||
====
|
||||
|
||||
[TIP]
|
||||
====
|
||||
When using Java 8 or later, you can omit the `@Mappings` wrapper annotation and directly specify several `@Mapping` annotations on one method.
|
||||
====
|
||||
|
||||
To get a better understanding of what MapStruct does have a look at the following implementation of the `carToCarDto()` method as generated by MapStruct:
|
||||
|
||||
|
@ -1,27 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF8"?>
|
||||
<toolchains>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>1.6</version>
|
||||
<vendor>oracle</vendor>
|
||||
<id>jdk1.6</id>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>/opt/jdk/jdk1.6.latest</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>1.7</version>
|
||||
<vendor>oracle</vendor>
|
||||
<id>jdk1.7</id>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>/opt/jdk/jdk1.7.latest</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
@ -33,5 +11,4 @@
|
||||
<jdkHome>/opt/jdk/jdk8.latest</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
|
||||
</toolchains>
|
||||
|
@ -1,27 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF8"?>
|
||||
<toolchains>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>1.6.0_45</version>
|
||||
<vendor>oracle</vendor>
|
||||
<id>jdk1.6</id>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>C:\Program Files\Java\jdk1.6.0_45</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>1.7.0_51</version>
|
||||
<vendor>oracle</vendor>
|
||||
<id>jdk1.7</id>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>C:\Program Files\Java\jdk1.7.0_51</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
|
@ -1,27 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF8"?>
|
||||
<toolchains>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>1.6</version>
|
||||
<vendor>oracle</vendor>
|
||||
<id>jdk1.6</id>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>/usr/lib/jvm/java-6-openjdk-amd64/</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>1.7</version>
|
||||
<vendor>oracle</vendor>
|
||||
<id>jdk1.7</id>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>/usr/lib/jvm/java-7-openjdk-amd64/</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
|
@ -59,14 +59,6 @@
|
||||
<escapeString>\</escapeString>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
@ -34,12 +34,8 @@ import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner;
|
||||
baseDir = "fullFeatureTest",
|
||||
commandLineEnhancer = CompilationExclusionCliEnhancer.class,
|
||||
processorTypes = {
|
||||
ProcessorType.ORACLE_JAVA_6,
|
||||
ProcessorType.ORACLE_JAVA_7,
|
||||
ProcessorType.ORACLE_JAVA_8,
|
||||
ProcessorType.ORACLE_JAVA_9,
|
||||
ProcessorType.ECLIPSE_JDT_JAVA_6,
|
||||
ProcessorType.ECLIPSE_JDT_JAVA_7,
|
||||
ProcessorType.ECLIPSE_JDT_JAVA_8
|
||||
})
|
||||
public class FullFeatureCompilationTest {
|
||||
@ -57,15 +53,6 @@ public class FullFeatureCompilationTest {
|
||||
additionalExcludes.add( "org/mapstruct/ap/test/bugs/_1596/*.java" );
|
||||
|
||||
switch ( processorType ) {
|
||||
case ORACLE_JAVA_6:
|
||||
additionalExcludes.add( "org/mapstruct/ap/test/abstractclass/generics/*.java" );
|
||||
additionalExcludes.add( "org/mapstruct/ap/test/bugs/_1170/*.java" );
|
||||
case ECLIPSE_JDT_JAVA_6:
|
||||
case ORACLE_JAVA_7:
|
||||
case ECLIPSE_JDT_JAVA_7:
|
||||
additionalExcludes.add( "org/mapstruct/ap/test/bugs/_1425/*.java" );
|
||||
additionalExcludes.add( "**/java8*/**/*.java" );
|
||||
break;
|
||||
case ORACLE_JAVA_9:
|
||||
// TODO find out why this fails:
|
||||
additionalExcludes.add( "org/mapstruct/ap/test/collection/wildcard/BeanMapper.java" );
|
||||
|
@ -15,8 +15,6 @@ import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner;
|
||||
@RunWith( ProcessorSuiteRunner.class )
|
||||
@ProcessorSuite( baseDir = "lombokBuilderTest",
|
||||
processorTypes = {
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_6,
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_7,
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_8,
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_9,
|
||||
}
|
||||
|
@ -17,12 +17,8 @@ import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner;
|
||||
@RunWith(ProcessorSuiteRunner.class)
|
||||
@ProcessorSuite(baseDir = "protobufBuilderTest",
|
||||
processorTypes = {
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_6,
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_7,
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_8,
|
||||
ProcessorSuite.ProcessorType.ORACLE_JAVA_9,
|
||||
ProcessorSuite.ProcessorType.ECLIPSE_JDT_JAVA_6,
|
||||
ProcessorSuite.ProcessorType.ECLIPSE_JDT_JAVA_7
|
||||
})
|
||||
public class ProtobufBuilderTest {
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
*/
|
||||
package org.mapstruct.itest.testutil.runner;
|
||||
|
||||
import org.apache.maven.it.Verifier;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@ -12,8 +14,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.maven.it.Verifier;
|
||||
|
||||
/**
|
||||
* Declares the content of the integration test.
|
||||
* <p />
|
||||
@ -39,15 +39,6 @@ public @interface ProcessorSuite {
|
||||
* @author Andreas Gudian
|
||||
*/
|
||||
enum ProcessorType {
|
||||
/**
|
||||
* Use an Oracle JDK 1.6 (or 1.6.x) via toolchain support to perform the processing
|
||||
*/
|
||||
ORACLE_JAVA_6( new Toolchain( "oracle", "1.6", "1.7" ), "javac", "1.6" ),
|
||||
|
||||
/**
|
||||
* Use an Oracle JDK 1.7 (or 1.7.x) via toolchain support to perform the processing
|
||||
*/
|
||||
ORACLE_JAVA_7( new Toolchain( "oracle", "1.7", "1.8" ), "javac", "1.7" ),
|
||||
|
||||
/**
|
||||
* Use the same JDK that runs the mvn build to perform the processing
|
||||
@ -59,18 +50,6 @@ public @interface ProcessorSuite {
|
||||
*/
|
||||
ORACLE_JAVA_9( new Toolchain( "oracle", "9", "10" ), "javac", "1.9" ),
|
||||
|
||||
/**
|
||||
* Use the eclipse compiler with 1.6 source/target level from tycho-compiler-jdt to perform the build and
|
||||
* processing
|
||||
*/
|
||||
ECLIPSE_JDT_JAVA_6( null, "jdt", "1.6" ),
|
||||
|
||||
/**
|
||||
* Use the eclipse compiler with 1.7 source/target level from tycho-compiler-jdt to perform the build and
|
||||
* processing
|
||||
*/
|
||||
ECLIPSE_JDT_JAVA_7( null, "jdt", "1.7" ),
|
||||
|
||||
/**
|
||||
* Use the eclipse compiler with 1.8 source/target level from tycho-compiler-jdt to perform the build and
|
||||
* processing
|
||||
@ -86,14 +65,12 @@ public @interface ProcessorSuite {
|
||||
/**
|
||||
* Use all processing variants, but without the maven-procesor-plugin
|
||||
*/
|
||||
ALL_WITHOUT_PROCESSOR_PLUGIN(ORACLE_JAVA_6, ORACLE_JAVA_7, ORACLE_JAVA_8, ORACLE_JAVA_9, ECLIPSE_JDT_JAVA_6,
|
||||
ECLIPSE_JDT_JAVA_7, ECLIPSE_JDT_JAVA_8),
|
||||
ALL_WITHOUT_PROCESSOR_PLUGIN( ORACLE_JAVA_8, ORACLE_JAVA_9, ECLIPSE_JDT_JAVA_8),
|
||||
|
||||
/**
|
||||
* Use all available processing variants
|
||||
*/
|
||||
ALL( ORACLE_JAVA_6, ORACLE_JAVA_7, ORACLE_JAVA_8, ORACLE_JAVA_9, ECLIPSE_JDT_JAVA_6, ECLIPSE_JDT_JAVA_7,
|
||||
ECLIPSE_JDT_JAVA_8, PROCESSOR_PLUGIN_JAVA_8 ),
|
||||
ALL( ORACLE_JAVA_8, ORACLE_JAVA_9, ECLIPSE_JDT_JAVA_8, PROCESSOR_PLUGIN_JAVA_8 ),
|
||||
|
||||
/**
|
||||
* Use all JDK8 compatible processing variants
|
||||
|
@ -200,13 +200,7 @@ public class ProcessorSuiteRunner extends ParentRunner<ProcessorTestCase> {
|
||||
|
||||
verifier.addCliOption( "-Dcompiler-source-target-version=" + child.processor.getSourceTargetVersion() );
|
||||
|
||||
if ( "1.8".equals( child.processor.getSourceTargetVersion() )
|
||||
|| "1.9".equals( child.processor.getSourceTargetVersion() ) ) {
|
||||
verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct-jdk8" );
|
||||
}
|
||||
else {
|
||||
verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct" );
|
||||
}
|
||||
verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct" );
|
||||
|
||||
if ( Boolean.getBoolean( SYS_PROP_DEBUG ) ) {
|
||||
originalOut.print( "Processor Integration Test: " );
|
||||
|
@ -34,8 +34,6 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgs>
|
||||
<compilerArg>-proc:none</compilerArg>
|
||||
</compilerArgs>
|
||||
|
@ -41,8 +41,6 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgs>
|
||||
<compilerArg>-XprintProcessorInfo</compilerArg>
|
||||
<compilerArg>-XprintRounds</compilerArg>
|
||||
|
@ -34,8 +34,6 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgs>
|
||||
<compilerArg>-proc:none</compilerArg>
|
||||
</compilerArgs>
|
||||
|
@ -41,8 +41,6 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgs>
|
||||
<compilerArg>-XprintProcessorInfo</compilerArg>
|
||||
<compilerArg>-XprintRounds</compilerArg>
|
||||
|
@ -242,11 +242,6 @@
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
@ -320,10 +315,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument>-proc:none</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -440,7 +435,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<version>3.2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.mycila.maven-license-plugin</groupId>
|
||||
@ -460,12 +455,12 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.9</version>
|
||||
<version>1.16</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm-all</artifactId>
|
||||
<version>5.0.2</version>
|
||||
<version>5.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
Loading…
x
Reference in New Issue
Block a user