#279 fix missing imports in builtin mapping methods

This commit is contained in:
Andreas Gudian 2014-08-14 21:03:47 +02:00
parent c5b6c64645
commit 7fdfc9e167
6 changed files with 10 additions and 13 deletions

View File

@ -46,6 +46,7 @@ public class CalendarToXmlGregorianCalendar extends BuiltInMethod {
this.importTypes = asSet(
returnType,
parameter.getType(),
typeFactory.getType( DatatypeFactory.class ),
typeFactory.getType( GregorianCalendar.class ),
typeFactory.getType( DatatypeConfigurationException.class )

View File

@ -25,9 +25,10 @@ import java.util.TimeZone;
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.util.Collections;
import org.mapstruct.ap.util.JavaTimeConstants;
import static org.mapstruct.ap.util.Collections.asSet;
/**
* {@link BuiltInMethod} for mapping between {@link java.util.Calendar}
* and {@link java.time.ZonedDateTime}.
@ -43,11 +44,7 @@ public class CalendarToZonedDateTime extends BuiltInMethod {
CalendarToZonedDateTime(TypeFactory typeFactory) {
this.returnType = typeFactory.getType( JavaTimeConstants.ZONED_DATE_TIME_FQN );
this.parameter = new Parameter( "cal", typeFactory.getType( Calendar.class ) );
this.importedTypes = Collections.asSet(
typeFactory.getType( Calendar.class ),
typeFactory.getType( TimeZone.class ),
typeFactory.getType( JavaTimeConstants.ZONED_DATE_TIME_FQN )
);
this.importedTypes = asSet( returnType, parameter.getType(), typeFactory.getType( TimeZone.class ) );
}
@Override

View File

@ -20,6 +20,7 @@ package org.mapstruct.ap.model.source.builtin;
import java.util.Calendar;
import java.util.Set;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.Parameter;
@ -40,7 +41,7 @@ public class XmlGregorianCalendarToCalendar extends BuiltInMethod {
public XmlGregorianCalendarToCalendar(TypeFactory typeFactory) {
this.parameter = new Parameter( "xcal", typeFactory.getType( XMLGregorianCalendar.class ) );
this.returnType = typeFactory.getType( Calendar.class );
this.importTypes = asSet( returnType, typeFactory.getType( XMLGregorianCalendar.class ) );
this.importTypes = asSet( returnType, parameter.getType() );
}
@Override

View File

@ -20,6 +20,7 @@ package org.mapstruct.ap.model.source.builtin;
import java.util.Date;
import java.util.Set;
import javax.xml.datatype.XMLGregorianCalendar;
import org.mapstruct.ap.model.common.Parameter;
@ -40,7 +41,7 @@ public class XmlGregorianCalendarToDate extends BuiltInMethod {
public XmlGregorianCalendarToDate(TypeFactory typeFactory) {
this.parameter = new Parameter( "xcal", typeFactory.getType( XMLGregorianCalendar.class ) );
this.returnType = typeFactory.getType( Date.class );
this.importTypes = asSet( returnType, typeFactory.getType( XMLGregorianCalendar.class ) );
this.importTypes = asSet( returnType, parameter.getType() );
}
@Override

View File

@ -43,7 +43,7 @@ public class XmlGregorianCalendarToString extends BuiltInMethod {
this.parameter = new Parameter( "xcal", typeFactory.getType( XMLGregorianCalendar.class ) );
this.returnType = typeFactory.getType( String.class );
this.importTypes = asSet(
typeFactory.getType( XMLGregorianCalendar.class ),
parameter.getType(),
typeFactory.getType( Date.class ),
typeFactory.getType( SimpleDateFormat.class )
);

View File

@ -41,10 +41,7 @@ public class ZonedDateTimeToCalendar extends BuiltInMethod {
ZonedDateTimeToCalendar(TypeFactory typeFactory) {
this.returnType = typeFactory.getType( Calendar.class );
this.parameter = new Parameter( "dateTime", typeFactory.getType( JavaTimeConstants.ZONED_DATE_TIME_FQN ) );
this.importedTypes = Collections.asSet(
typeFactory.getType( Calendar.class ),
typeFactory.getType( JavaTimeConstants.ZONED_DATE_TIME_FQN )
);
this.importedTypes = Collections.asSet( returnType, parameter.getType() );
}
@Override