#109 Breaking up cycle between model and source model by extracting package with shared types

This commit is contained in:
Gunnar Morling 2014-01-26 12:38:27 +01:00
parent dae4e94a0a
commit e23ee852fa
30 changed files with 77 additions and 23 deletions

View File

@ -20,9 +20,9 @@ package org.mapstruct.ap.conversion;
import java.util.Date;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.TypeConversion;
import org.mapstruct.ap.model.TypeFactory;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
/**
* Implementations create inline {@link TypeConversion}s such as

View File

@ -26,8 +26,8 @@ import java.util.Map;
import javax.lang.model.util.Elements;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.TypeFactory;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
import static org.mapstruct.ap.conversion.ReverseConversion.reverse;

View File

@ -24,8 +24,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.TypeConversion;
import org.mapstruct.ap.model.common.Type;
import static org.mapstruct.ap.util.Collections.asSet;

View File

@ -19,8 +19,8 @@
package org.mapstruct.ap.conversion;
import org.mapstruct.ap.conversion.ConversionProvider.Context;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.TypeFactory;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
/**
* Default implementation of the {@link Context} passed to conversion providers.

View File

@ -21,6 +21,9 @@ package org.mapstruct.ap.model;
import java.util.Collections;
import java.util.Set;
import org.mapstruct.ap.model.common.ModelElement;
import org.mapstruct.ap.model.common.Type;
/**
* Represents a Java 5 annotation.
*

View File

@ -21,6 +21,7 @@ package org.mapstruct.ap.model;
import java.beans.Introspector;
import java.util.Set;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.util.Collections;
import org.mapstruct.ap.util.Strings;

View File

@ -24,6 +24,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.Method;
/**

View File

@ -21,6 +21,8 @@ package org.mapstruct.ap.model;
import java.beans.Introspector;
import java.util.Set;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
import org.mapstruct.ap.util.Collections;
import org.mapstruct.ap.util.Strings;

View File

@ -21,6 +21,8 @@ package org.mapstruct.ap.model;
import java.beans.Introspector;
import java.util.Set;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.Method;
import org.mapstruct.ap.util.Strings;

View File

@ -20,6 +20,8 @@ package org.mapstruct.ap.model;
import java.util.Set;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.Method;
import org.mapstruct.ap.util.Strings;

View File

@ -29,6 +29,10 @@ import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import org.mapstruct.ap.model.common.ModelElement;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
/**
* Represents a type implementing a mapper interface (annotated with {@code @Mapper}). This is the root object of the
* mapper model.

View File

@ -18,6 +18,9 @@
*/
package org.mapstruct.ap.model;
import org.mapstruct.ap.model.common.ModelElement;
import org.mapstruct.ap.model.common.Type;
/**
* A reference to another mapper class, which itself may be generated or hand-written.
*

View File

@ -24,6 +24,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.mapstruct.ap.model.common.ModelElement;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.Method;
import org.mapstruct.ap.util.Strings;

View File

@ -22,6 +22,7 @@ import java.beans.Introspector;
import java.util.HashSet;
import java.util.Set;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.Method;
import org.mapstruct.ap.util.Strings;

View File

@ -21,6 +21,9 @@ package org.mapstruct.ap.model;
import java.util.HashSet;
import java.util.Set;
import org.mapstruct.ap.model.common.ModelElement;
import org.mapstruct.ap.model.common.Type;
/**
* Represents the mapping between a source and target property, e.g. from
* {@code String Source#foo} to {@code int Target#bar}. Name and type of source

View File

@ -23,6 +23,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.mapstruct.ap.model.common.ModelElement;
import org.mapstruct.ap.model.common.Type;
/**
* An inline conversion between source and target type of a mapping.
*

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.model;
package org.mapstruct.ap.model.common;
import java.io.Writer;
import java.util.Set;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.model;
package org.mapstruct.ap.model.common;
import java.util.Set;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.model;
package org.mapstruct.ap.model.common;
import java.util.Collections;
import java.util.List;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.model;
package org.mapstruct.ap.model.common;
import java.util.ArrayList;
import java.util.Collection;

View File

@ -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.
*/
/**
* <p>
* Contains types which are shared between the intermediary mapping method model ("source model") and the mapper model.
* </p>
*/
package org.mapstruct.ap.model.common;

View File

@ -22,11 +22,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import org.mapstruct.ap.model.Parameter;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.util.Strings;
/**

View File

@ -35,7 +35,7 @@ import javax.lang.model.type.WildcardType;
import javax.lang.model.util.SimpleTypeVisitor6;
import javax.lang.model.util.Types;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.common.Type;
/**
* MethodMatcher $8.4 of the JavaLanguage specification describes a method body as such:

View File

@ -26,7 +26,7 @@ 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.model.common.TypeFactory;
import org.mapstruct.ap.option.OptionsHelper;
import org.mapstruct.ap.prism.MapperPrism;

View File

@ -28,7 +28,7 @@ import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic.Kind;
import org.mapstruct.ap.model.TypeFactory;
import org.mapstruct.ap.model.common.TypeFactory;
import org.mapstruct.ap.option.Options;
/**

View File

@ -52,11 +52,11 @@ import org.mapstruct.ap.model.Mapper;
import org.mapstruct.ap.model.MapperReference;
import org.mapstruct.ap.model.MappingMethod;
import org.mapstruct.ap.model.MappingMethodReference;
import org.mapstruct.ap.model.Parameter;
import org.mapstruct.ap.model.PropertyMapping;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.TypeConversion;
import org.mapstruct.ap.model.TypeFactory;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
import org.mapstruct.ap.model.source.Mapping;
import org.mapstruct.ap.model.source.Method;
import org.mapstruct.ap.model.source.MethodMatcher;

View File

@ -34,9 +34,9 @@ import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic.Kind;
import org.mapstruct.ap.model.Parameter;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.model.TypeFactory;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
import org.mapstruct.ap.model.source.IterableMapping;
import org.mapstruct.ap.model.source.MapMapping;
import org.mapstruct.ap.model.source.Mapping;

View File

@ -25,7 +25,7 @@ import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic.Kind;
import org.mapstruct.ap.model.TypeFactory;
import org.mapstruct.ap.model.common.TypeFactory;
import org.mapstruct.ap.option.Options;
/**