diff --git a/processor/src/main/java/org/mapstruct/ap/MappingProcessor.java b/processor/src/main/java/org/mapstruct/ap/MappingProcessor.java index 776d71b1d..a4bfd929a 100644 --- a/processor/src/main/java/org/mapstruct/ap/MappingProcessor.java +++ b/processor/src/main/java/org/mapstruct/ap/MappingProcessor.java @@ -39,15 +39,7 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.util.ElementKindVisitor6; import javax.tools.Diagnostic.Kind; -import net.java.dev.hickory.prism.GeneratePrism; -import net.java.dev.hickory.prism.GeneratePrisms; - -import org.mapstruct.IterableMapping; -import org.mapstruct.MapMapping; import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.MappingTarget; -import org.mapstruct.Mappings; import org.mapstruct.ap.option.Options; import org.mapstruct.ap.option.ReportingPolicy; import org.mapstruct.ap.processor.DefaultModelElementProcessorContext; @@ -88,14 +80,6 @@ import org.mapstruct.ap.util.AnnotationProcessingException; * @author Gunnar Morling */ @SupportedAnnotationTypes("org.mapstruct.Mapper") -@GeneratePrisms({ - @GeneratePrism(value = Mapper.class, publicAccess = true), - @GeneratePrism(value = Mapping.class, publicAccess = true), - @GeneratePrism(value = Mappings.class, publicAccess = true), - @GeneratePrism(value = IterableMapping.class, publicAccess = true), - @GeneratePrism(value = MapMapping.class, publicAccess = true), - @GeneratePrism(value = MappingTarget.class, publicAccess = true) -}) @SupportedOptions({ MappingProcessor.SUPPRESS_GENERATOR_TIMESTAMP, MappingProcessor.UNMAPPED_TARGET_POLICY, diff --git a/processor/src/main/java/org/mapstruct/ap/model/Parameter.java b/processor/src/main/java/org/mapstruct/ap/model/common/Parameter.java similarity index 100% rename from processor/src/main/java/org/mapstruct/ap/model/Parameter.java rename to processor/src/main/java/org/mapstruct/ap/model/common/Parameter.java diff --git a/processor/src/main/java/org/mapstruct/ap/model/Type.java b/processor/src/main/java/org/mapstruct/ap/model/common/Type.java similarity index 100% rename from processor/src/main/java/org/mapstruct/ap/model/Type.java rename to processor/src/main/java/org/mapstruct/ap/model/common/Type.java diff --git a/processor/src/main/java/org/mapstruct/ap/model/TypeFactory.java b/processor/src/main/java/org/mapstruct/ap/model/common/TypeFactory.java similarity index 99% rename from processor/src/main/java/org/mapstruct/ap/model/TypeFactory.java rename to processor/src/main/java/org/mapstruct/ap/model/common/TypeFactory.java index b76d4ec32..fdefc98ff 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/TypeFactory.java +++ b/processor/src/main/java/org/mapstruct/ap/model/common/TypeFactory.java @@ -45,7 +45,7 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import org.mapstruct.ap.MappingTargetPrism; +import org.mapstruct.ap.prism.MappingTargetPrism; import org.mapstruct.ap.util.AnnotationProcessingException; /** diff --git a/processor/src/main/java/org/mapstruct/ap/model/source/IterableMapping.java b/processor/src/main/java/org/mapstruct/ap/model/source/IterableMapping.java index 2eff1fc22..1e2ee91e6 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/source/IterableMapping.java +++ b/processor/src/main/java/org/mapstruct/ap/model/source/IterableMapping.java @@ -21,7 +21,7 @@ package org.mapstruct.ap.model.source; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationValue; -import org.mapstruct.ap.IterableMappingPrism; +import org.mapstruct.ap.prism.IterableMappingPrism; /** * Represents an iterable mapping as configured via {@code @IterableMapping}. diff --git a/processor/src/main/java/org/mapstruct/ap/model/source/MapMapping.java b/processor/src/main/java/org/mapstruct/ap/model/source/MapMapping.java index 2808d4d11..48bfdd873 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/source/MapMapping.java +++ b/processor/src/main/java/org/mapstruct/ap/model/source/MapMapping.java @@ -20,7 +20,7 @@ package org.mapstruct.ap.model.source; import javax.lang.model.element.AnnotationMirror; -import org.mapstruct.ap.MapMappingPrism; +import org.mapstruct.ap.prism.MapMappingPrism; /** * Represents a map mapping as configured via {@code @MapMapping}. 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 6369ec553..7fa273395 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 @@ -27,8 +27,8 @@ import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.Element; -import org.mapstruct.ap.MappingPrism; -import org.mapstruct.ap.MappingsPrism; +import org.mapstruct.ap.prism.MappingPrism; +import org.mapstruct.ap.prism.MappingsPrism; import org.mapstruct.ap.util.AnnotationProcessingException; /** diff --git a/processor/src/main/java/org/mapstruct/ap/prism/PrismGenerator.java b/processor/src/main/java/org/mapstruct/ap/prism/PrismGenerator.java new file mode 100644 index 000000000..e73a8131d --- /dev/null +++ b/processor/src/main/java/org/mapstruct/ap/prism/PrismGenerator.java @@ -0,0 +1,46 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.prism; + +import net.java.dev.hickory.prism.GeneratePrism; +import net.java.dev.hickory.prism.GeneratePrisms; + +import org.mapstruct.IterableMapping; +import org.mapstruct.MapMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.Mappings; + +/** + * Triggers the generation of prism types using Hickory. + * + * @author Gunnar Morling + */ +@GeneratePrisms({ + @GeneratePrism(value = Mapper.class, publicAccess = true), + @GeneratePrism(value = Mapping.class, publicAccess = true), + @GeneratePrism(value = Mappings.class, publicAccess = true), + @GeneratePrism(value = IterableMapping.class, publicAccess = true), + @GeneratePrism(value = MapMapping.class, publicAccess = true), + @GeneratePrism(value = MappingTarget.class, publicAccess = true) +}) +public class PrismGenerator { + +} diff --git a/processor/src/main/java/org/mapstruct/ap/prism/package-info.java b/processor/src/main/java/org/mapstruct/ap/prism/package-info.java new file mode 100644 index 000000000..733fbce21 --- /dev/null +++ b/processor/src/main/java/org/mapstruct/ap/prism/package-info.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + *

+ * This package contains the generated prism types for accessing the MapStruct annotations in a comfortable way. + *

+ */ +package org.mapstruct.ap.prism; diff --git a/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java b/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java index 894e9bfbf..7371f9a07 100644 --- a/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java +++ b/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java @@ -22,13 +22,13 @@ import java.util.ListIterator; import javax.lang.model.element.TypeElement; -import org.mapstruct.ap.MapperPrism; import org.mapstruct.ap.model.Annotation; import org.mapstruct.ap.model.AnnotationMapperReference; import org.mapstruct.ap.model.Mapper; import org.mapstruct.ap.model.MapperReference; import org.mapstruct.ap.model.TypeFactory; import org.mapstruct.ap.option.OptionsHelper; +import org.mapstruct.ap.prism.MapperPrism; /** * An {@link ModelElementProcessor} which converts the given {@link Mapper} 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 9bfe56fa6..dab0dc1c4 100644 --- a/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java +++ b/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java @@ -41,7 +41,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; import javax.tools.Diagnostic.Kind; -import org.mapstruct.ap.MapperPrism; import org.mapstruct.ap.conversion.ConversionProvider; import org.mapstruct.ap.conversion.Conversions; import org.mapstruct.ap.conversion.DefaultConversionContext; @@ -63,6 +62,7 @@ import org.mapstruct.ap.model.source.Method; import org.mapstruct.ap.model.source.MethodMatcher; import org.mapstruct.ap.option.Options; import org.mapstruct.ap.option.ReportingPolicy; +import org.mapstruct.ap.prism.MapperPrism; import org.mapstruct.ap.util.Executables; import org.mapstruct.ap.util.Filters; import org.mapstruct.ap.util.Strings; diff --git a/processor/src/main/java/org/mapstruct/ap/processor/MethodRetrievalProcessor.java b/processor/src/main/java/org/mapstruct/ap/processor/MethodRetrievalProcessor.java index 9aeda8d03..996ffec1e 100644 --- a/processor/src/main/java/org/mapstruct/ap/processor/MethodRetrievalProcessor.java +++ b/processor/src/main/java/org/mapstruct/ap/processor/MethodRetrievalProcessor.java @@ -34,11 +34,6 @@ import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.tools.Diagnostic.Kind; -import org.mapstruct.ap.IterableMappingPrism; -import org.mapstruct.ap.MapMappingPrism; -import org.mapstruct.ap.MapperPrism; -import org.mapstruct.ap.MappingPrism; -import org.mapstruct.ap.MappingsPrism; import org.mapstruct.ap.model.Parameter; import org.mapstruct.ap.model.Type; import org.mapstruct.ap.model.TypeFactory; @@ -46,6 +41,11 @@ import org.mapstruct.ap.model.source.IterableMapping; import org.mapstruct.ap.model.source.MapMapping; import org.mapstruct.ap.model.source.Mapping; import org.mapstruct.ap.model.source.Method; +import org.mapstruct.ap.prism.IterableMappingPrism; +import org.mapstruct.ap.prism.MapMappingPrism; +import org.mapstruct.ap.prism.MapperPrism; +import org.mapstruct.ap.prism.MappingPrism; +import org.mapstruct.ap.prism.MappingsPrism; import org.mapstruct.ap.util.AnnotationProcessingException; /**