#120 Moving built-in methods to o.m.a.model.source.builtin

This commit is contained in:
Gunnar Morling 2014-02-22 21:24:35 +01:00
parent bc5dda82f8
commit 52ccedb0e1
22 changed files with 36 additions and 24 deletions

View File

@ -23,8 +23,8 @@ import java.util.Set;
import org.mapstruct.ap.model.common.ConversionContext;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.BuiltInMethod;
import org.mapstruct.ap.model.source.SourceMethod;
import org.mapstruct.ap.model.source.builtin.BuiltInMethod;
/**
* Represents a reference to {@link MappingMethod}.

View File

@ -21,7 +21,7 @@ package org.mapstruct.ap.model;
import java.util.Set;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.BuiltInMethod;
import org.mapstruct.ap.model.source.builtin.BuiltInMethod;
/**
* A mapping method which is not based on an actual method declared in the original mapper interface but is added as
@ -31,13 +31,15 @@ import org.mapstruct.ap.model.source.BuiltInMethod;
*/
public class VirtualMappingMethod extends MappingMethod {
private static final String BUILTIN_METHOD_TEMPLATE_PREFIX = "org.mapstruct.ap.model.builtin.";
private final String templateName;
private final Set<Type> importTypes;
public VirtualMappingMethod(BuiltInMethod method) {
super( method );
this.importTypes = method.getImportTypes();
this.templateName = method.getClass().getName() + ".ftl";
this.templateName = BUILTIN_METHOD_TEMPLATE_PREFIX + method.getClass().getSimpleName() + ".ftl";
}
@Override

View File

@ -24,6 +24,7 @@ import java.util.List;
import org.mapstruct.ap.model.common.Accessibility;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.source.builtin.BuiltInMethod;
/**
* This interface makes available common method properties and a matching method

View File

@ -16,13 +16,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import java.util.Arrays;
import java.util.List;
import org.mapstruct.ap.model.common.TypeFactory;
import org.mapstruct.ap.model.source.BuiltInMethod;
/**
* Registry for all built-in methods.

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.source;
package org.mapstruct.ap.model.source.builtin;
import java.util.Arrays;
import java.util.Collections;
@ -28,6 +28,7 @@ import org.mapstruct.ap.model.common.ConversionContext;
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

@ -16,18 +16,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import org.mapstruct.ap.model.source.BuiltInMethod;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Set;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
import static org.mapstruct.ap.util.Collections.asSet;
/**

View File

@ -16,18 +16,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import org.mapstruct.ap.model.source.BuiltInMethod;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Set;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
import static org.mapstruct.ap.util.Collections.asSet;
/**

View File

@ -16,10 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import org.mapstruct.ap.model.source.BuiltInMethod;
import javax.xml.bind.JAXBElement;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;

View File

@ -16,11 +16,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import org.mapstruct.ap.model.source.BuiltInMethod;
import java.util.List;
import javax.xml.bind.JAXBElement;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;

View File

@ -16,21 +16,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.mapstruct.ap.model.source.BuiltInMethod;
import java.util.GregorianCalendar;
import java.util.Set;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.ConversionContext;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;
import static org.mapstruct.ap.util.Collections.asSet;
/**

View File

@ -16,11 +16,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import org.mapstruct.ap.model.source.BuiltInMethod;
import java.util.Calendar;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;

View File

@ -16,11 +16,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import org.mapstruct.ap.model.source.BuiltInMethod;
import java.util.Date;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;
import org.mapstruct.ap.model.common.TypeFactory;

View File

@ -16,10 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.builtin;
package org.mapstruct.ap.model.source.builtin;
import org.mapstruct.ap.model.source.BuiltInMethod;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.ConversionContext;
import org.mapstruct.ap.model.common.Parameter;
import org.mapstruct.ap.model.common.Type;

View File

@ -37,7 +37,6 @@ import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic.Kind;
import org.mapstruct.ap.builtin.BuiltInMappingMethods;
import org.mapstruct.ap.conversion.ConversionProvider;
import org.mapstruct.ap.conversion.Conversions;
import org.mapstruct.ap.model.BeanMappingMethod;
@ -56,10 +55,11 @@ import org.mapstruct.ap.model.common.DefaultConversionContext;
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.BuiltInMethod;
import org.mapstruct.ap.model.source.Mapping;
import org.mapstruct.ap.model.source.Method;
import org.mapstruct.ap.model.source.SourceMethod;
import org.mapstruct.ap.model.source.builtin.BuiltInMappingMethods;
import org.mapstruct.ap.model.source.builtin.BuiltInMethod;
import org.mapstruct.ap.option.Options;
import org.mapstruct.ap.option.ReportingPolicy;
import org.mapstruct.ap.prism.MapperPrism;