#1 Adding primitive to wrapper conversions for boolean and char; Doing some clean-up

This commit is contained in:
Gunnar Morling 2013-05-19 17:19:34 +02:00
parent fcbbd73cda
commit 87e0da6f96
40 changed files with 453 additions and 181 deletions

View File

@ -42,82 +42,85 @@ public class Conversions {
this.enumType = typeUtils.getDeclaredType( elementUtils.getTypeElement( Enum.class.getCanonicalName() ) );
this.stringType = typeUtils.getDeclaredType( elementUtils.getTypeElement( String.class.getCanonicalName() ) );
registerNumberConversion( byte.class, Byte.class );
registerNumberConversion( byte.class, short.class );
registerNumberConversion( byte.class, Short.class );
registerNumberConversion( byte.class, int.class );
registerNumberConversion( byte.class, Integer.class );
registerNumberConversion( byte.class, long.class );
registerNumberConversion( byte.class, Long.class );
registerNumberConversion( byte.class, float.class );
registerNumberConversion( byte.class, Float.class );
registerNumberConversion( byte.class, double.class );
registerNumberConversion( byte.class, Double.class );
registerNativeTypeConversion( byte.class, Byte.class );
registerNativeTypeConversion( byte.class, short.class );
registerNativeTypeConversion( byte.class, Short.class );
registerNativeTypeConversion( byte.class, int.class );
registerNativeTypeConversion( byte.class, Integer.class );
registerNativeTypeConversion( byte.class, long.class );
registerNativeTypeConversion( byte.class, Long.class );
registerNativeTypeConversion( byte.class, float.class );
registerNativeTypeConversion( byte.class, Float.class );
registerNativeTypeConversion( byte.class, double.class );
registerNativeTypeConversion( byte.class, Double.class );
registerNumberConversion( Byte.class, short.class );
registerNumberConversion( Byte.class, Short.class );
registerNumberConversion( Byte.class, int.class );
registerNumberConversion( Byte.class, Integer.class );
registerNumberConversion( Byte.class, long.class );
registerNumberConversion( Byte.class, Long.class );
registerNumberConversion( Byte.class, float.class );
registerNumberConversion( Byte.class, Float.class );
registerNumberConversion( Byte.class, double.class );
registerNumberConversion( Byte.class, Double.class );
registerNativeTypeConversion( Byte.class, short.class );
registerNativeTypeConversion( Byte.class, Short.class );
registerNativeTypeConversion( Byte.class, int.class );
registerNativeTypeConversion( Byte.class, Integer.class );
registerNativeTypeConversion( Byte.class, long.class );
registerNativeTypeConversion( Byte.class, Long.class );
registerNativeTypeConversion( Byte.class, float.class );
registerNativeTypeConversion( Byte.class, Float.class );
registerNativeTypeConversion( Byte.class, double.class );
registerNativeTypeConversion( Byte.class, Double.class );
registerNumberConversion( short.class, Short.class );
registerNumberConversion( short.class, int.class );
registerNumberConversion( short.class, Integer.class );
registerNumberConversion( short.class, long.class );
registerNumberConversion( short.class, Long.class );
registerNumberConversion( short.class, float.class );
registerNumberConversion( short.class, Float.class );
registerNumberConversion( short.class, double.class );
registerNumberConversion( short.class, Double.class );
registerNativeTypeConversion( short.class, Short.class );
registerNativeTypeConversion( short.class, int.class );
registerNativeTypeConversion( short.class, Integer.class );
registerNativeTypeConversion( short.class, long.class );
registerNativeTypeConversion( short.class, Long.class );
registerNativeTypeConversion( short.class, float.class );
registerNativeTypeConversion( short.class, Float.class );
registerNativeTypeConversion( short.class, double.class );
registerNativeTypeConversion( short.class, Double.class );
registerNumberConversion( Short.class, int.class );
registerNumberConversion( Short.class, Integer.class );
registerNumberConversion( Short.class, long.class );
registerNumberConversion( Short.class, Long.class );
registerNumberConversion( Short.class, float.class );
registerNumberConversion( Short.class, Float.class );
registerNumberConversion( Short.class, double.class );
registerNumberConversion( Short.class, Double.class );
registerNativeTypeConversion( Short.class, int.class );
registerNativeTypeConversion( Short.class, Integer.class );
registerNativeTypeConversion( Short.class, long.class );
registerNativeTypeConversion( Short.class, Long.class );
registerNativeTypeConversion( Short.class, float.class );
registerNativeTypeConversion( Short.class, Float.class );
registerNativeTypeConversion( Short.class, double.class );
registerNativeTypeConversion( Short.class, Double.class );
registerNumberConversion( int.class, Integer.class );
registerNumberConversion( int.class, long.class );
registerNumberConversion( int.class, Long.class );
registerNumberConversion( int.class, float.class );
registerNumberConversion( int.class, Float.class );
registerNumberConversion( int.class, double.class );
registerNumberConversion( int.class, Double.class );
registerNativeTypeConversion( int.class, Integer.class );
registerNativeTypeConversion( int.class, long.class );
registerNativeTypeConversion( int.class, Long.class );
registerNativeTypeConversion( int.class, float.class );
registerNativeTypeConversion( int.class, Float.class );
registerNativeTypeConversion( int.class, double.class );
registerNativeTypeConversion( int.class, Double.class );
registerNumberConversion( Integer.class, long.class );
registerNumberConversion( Integer.class, Long.class );
registerNumberConversion( Integer.class, float.class );
registerNumberConversion( Integer.class, Float.class );
registerNumberConversion( Integer.class, double.class );
registerNumberConversion( Integer.class, Double.class );
registerNativeTypeConversion( Integer.class, long.class );
registerNativeTypeConversion( Integer.class, Long.class );
registerNativeTypeConversion( Integer.class, float.class );
registerNativeTypeConversion( Integer.class, Float.class );
registerNativeTypeConversion( Integer.class, double.class );
registerNativeTypeConversion( Integer.class, Double.class );
registerNumberConversion( long.class, Long.class );
registerNumberConversion( long.class, float.class );
registerNumberConversion( long.class, Float.class );
registerNumberConversion( long.class, double.class );
registerNumberConversion( long.class, Double.class );
registerNativeTypeConversion( long.class, Long.class );
registerNativeTypeConversion( long.class, float.class );
registerNativeTypeConversion( long.class, Float.class );
registerNativeTypeConversion( long.class, double.class );
registerNativeTypeConversion( long.class, Double.class );
registerNumberConversion( Long.class, float.class );
registerNumberConversion( Long.class, Float.class );
registerNumberConversion( Long.class, double.class );
registerNumberConversion( Long.class, Double.class );
registerNativeTypeConversion( Long.class, float.class );
registerNativeTypeConversion( Long.class, Float.class );
registerNativeTypeConversion( Long.class, double.class );
registerNativeTypeConversion( Long.class, Double.class );
registerNumberConversion( float.class, Float.class );
registerNumberConversion( float.class, double.class );
registerNumberConversion( float.class, Double.class );
registerNativeTypeConversion( float.class, Float.class );
registerNativeTypeConversion( float.class, double.class );
registerNativeTypeConversion( float.class, Double.class );
registerNumberConversion( Float.class, double.class );
registerNumberConversion( Float.class, Double.class );
registerNativeTypeConversion( Float.class, double.class );
registerNativeTypeConversion( Float.class, Double.class );
registerNumberConversion( double.class, Double.class );
registerNativeTypeConversion( double.class, Double.class );
registerNativeTypeConversion( boolean.class, Boolean.class );
registerNativeTypeConversion( char.class, Character.class );
registerToStringConversion( byte.class );
registerToStringConversion( Byte.class );
@ -139,7 +142,7 @@ public class Conversions {
register( Enum.class, String.class, new EnumStringConversion() );
}
private void registerNumberConversion(Class<?> sourceType, Class<?> targetType) {
private void registerNativeTypeConversion(Class<?> sourceType, Class<?> targetType) {
if ( sourceType.isPrimitive() && targetType.isPrimitive() ) {
register( sourceType, targetType, new PrimitiveToPrimitiveConversion( sourceType ) );
}

View File

@ -18,30 +18,12 @@
*/
package org.mapstruct.ap.conversion;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.util.NativeTypes;
import org.mapstruct.ap.util.Strings;
public class PrimitiveToStringConversion implements Conversion {
private final static Map<Class<?>, Class<?>> primitiveToWrapperTypes;
static {
Map<Class<?>, Class<?>> tmp = new HashMap<Class<?>, Class<?>>();
tmp.put( byte.class, Byte.class );
tmp.put( short.class, Short.class );
tmp.put( int.class, Integer.class );
tmp.put( long.class, Long.class );
tmp.put( float.class, Float.class );
tmp.put( double.class, Double.class );
tmp.put( boolean.class, Boolean.class );
primitiveToWrapperTypes = Collections.unmodifiableMap( tmp );
}
private final Class<?> sourceType;
private final Class<?> wrapperType;
@ -51,7 +33,7 @@ public class PrimitiveToStringConversion implements Conversion {
}
this.sourceType = sourceType;
this.wrapperType = primitiveToWrapperTypes.get( sourceType );
this.wrapperType = NativeTypes.getWrapperType( sourceType );
}
@Override

View File

@ -18,28 +18,11 @@
*/
package org.mapstruct.ap.conversion;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.util.NativeTypes;
public class PrimitiveToWrapperConversion implements Conversion {
private final static Map<Class<?>, Class<?>> wrapperToPrimitiveTypes;
static {
Map<Class<?>, Class<?>> tmp = new HashMap<Class<?>, Class<?>>();
tmp.put( Byte.class, byte.class );
tmp.put( Short.class, short.class );
tmp.put( Integer.class, int.class );
tmp.put( Long.class, long.class );
tmp.put( Float.class, float.class );
tmp.put( Double.class, double.class );
wrapperToPrimitiveTypes = Collections.unmodifiableMap( tmp );
}
private final Class<?> sourceType;
private final Class<?> targetType;
@ -52,7 +35,7 @@ public class PrimitiveToWrapperConversion implements Conversion {
}
this.sourceType = sourceType;
this.targetType = wrapperToPrimitiveTypes.get( targetType );
this.targetType = NativeTypes.getPrimitiveType( targetType );
}
@Override

View File

@ -18,30 +18,12 @@
*/
package org.mapstruct.ap.conversion;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.util.NativeTypes;
import org.mapstruct.ap.util.Strings;
public class WrapperToStringConversion implements Conversion {
private final static Map<Class<?>, Class<?>> wrapperToPrimitiveTypes;
static {
Map<Class<?>, Class<?>> tmp = new HashMap<Class<?>, Class<?>>();
tmp.put( Byte.class, byte.class );
tmp.put( Short.class, short.class );
tmp.put( Integer.class, int.class );
tmp.put( Long.class, long.class );
tmp.put( Float.class, float.class );
tmp.put( Double.class, double.class );
tmp.put( Boolean.class, boolean.class );
wrapperToPrimitiveTypes = Collections.unmodifiableMap( tmp );
}
private final Class<?> sourceType;
private final Class<?> primitiveType;
@ -51,7 +33,7 @@ public class WrapperToStringConversion implements Conversion {
}
this.sourceType = sourceType;
this.primitiveType = wrapperToPrimitiveTypes.get( sourceType );
this.primitiveType = NativeTypes.getPrimitiveType( sourceType );
}
@Override

View File

@ -18,28 +18,11 @@
*/
package org.mapstruct.ap.conversion;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.mapstruct.ap.model.Type;
import org.mapstruct.ap.util.NativeTypes;
public class WrapperToWrapperConversion implements Conversion {
private final static Map<Class<?>, Class<?>> wrapperToPrimitiveTypes;
static {
Map<Class<?>, Class<?>> tmp = new HashMap<Class<?>, Class<?>>();
tmp.put( Byte.class, byte.class );
tmp.put( Short.class, short.class );
tmp.put( Integer.class, int.class );
tmp.put( Long.class, long.class );
tmp.put( Float.class, float.class );
tmp.put( Double.class, double.class );
wrapperToPrimitiveTypes = Collections.unmodifiableMap( tmp );
}
private final Class<?> sourceType;
private final Class<?> targetType;
@ -51,8 +34,8 @@ public class WrapperToWrapperConversion implements Conversion {
throw new IllegalArgumentException( targetType + " is no wrapper type." );
}
this.sourceType = wrapperToPrimitiveTypes.get( sourceType );
this.targetType = wrapperToPrimitiveTypes.get( targetType );
this.sourceType = NativeTypes.getPrimitiveType( sourceType );
this.targetType = NativeTypes.getPrimitiveType( targetType );
}
@Override

View File

@ -0,0 +1,71 @@
/**
* Copyright 2012-2013 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.util;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class NativeTypes {
private final static Map<Class<?>, Class<?>> wrapperToPrimitiveTypes;
private final static Map<Class<?>, Class<?>> primitiveToWrapperTypes;
static {
Map<Class<?>, Class<?>> tmp = new HashMap<Class<?>, Class<?>>();
tmp.put( Byte.class, byte.class );
tmp.put( Short.class, short.class );
tmp.put( Integer.class, int.class );
tmp.put( Long.class, long.class );
tmp.put( Float.class, float.class );
tmp.put( Double.class, double.class );
tmp.put( Boolean.class, boolean.class );
tmp.put( Character.class, char.class );
wrapperToPrimitiveTypes = Collections.unmodifiableMap( tmp );
tmp = new HashMap<Class<?>, Class<?>>();
tmp.put( byte.class, Byte.class );
tmp.put( short.class, Short.class );
tmp.put( int.class, Integer.class );
tmp.put( long.class, Long.class );
tmp.put( float.class, Float.class );
tmp.put( double.class, Double.class );
tmp.put( boolean.class, Boolean.class );
tmp.put( char.class, Character.class );
primitiveToWrapperTypes = Collections.unmodifiableMap( tmp );
}
public static Class<?> getWrapperType(Class<?> clazz) {
if ( !clazz.isPrimitive() ) {
throw new IllegalArgumentException( clazz + " is no primitive type." );
}
return primitiveToWrapperTypes.get( clazz );
}
public static Class<?> getPrimitiveType(Class<?> clazz) {
if ( clazz.isPrimitive() ) {
throw new IllegalArgumentException( clazz + " is no wrapper type." );
}
return wrapperToPrimitiveTypes.get( clazz );
}
}

View File

@ -0,0 +1,55 @@
/**
* Copyright 2012-2013 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.test.conversion.nativetypes;
import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses;
import org.testng.annotations.Test;
import static org.fest.assertions.Assertions.assertThat;
@WithClasses({
BooleanSource.class,
BooleanTarget.class,
BooleanMapper.class
})
public class BooleanConversionTest extends MapperTestBase {
@Test
public void shouldApplyBooleanConversion() {
BooleanSource source = new BooleanSource();
source.setBool( true );
BooleanTarget target = BooleanMapper.INSTANCE.sourceToTarget( source );
assertThat( target ).isNotNull();
assertThat( target.getBool() ).isEqualTo( Boolean.TRUE );
}
@Test
public void shouldApplyReverseBooleanConversion() {
BooleanTarget target = new BooleanTarget();
target.setBool( Boolean.TRUE );
BooleanSource source = BooleanMapper.INSTANCE.targetToSource( target );
assertThat( source ).isNotNull();
assertThat( source.getBool() ).isEqualTo( true );
}
}

View File

@ -0,0 +1,32 @@
/**
* Copyright 2012-2013 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.test.conversion.nativetypes;
import org.mapstruct.Mapper;
import org.mapstruct.Mappers;
@Mapper
public interface BooleanMapper {
public static BooleanMapper INSTANCE = Mappers.getMapper( BooleanMapper.class );
BooleanTarget sourceToTarget(BooleanSource source);
BooleanSource targetToSource(BooleanTarget target);
}

View File

@ -16,19 +16,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.conversion;
package org.mapstruct.ap.test.conversion.nativetypes;
import org.mapstruct.ap.model.Type;
public class BooleanSource {
public class IntegerStringConversion implements Conversion {
private boolean bool;
@Override
public String to(String sourcePropertyAccessor, Type type) {
return "String.valueOf( " + sourcePropertyAccessor + " )";
public boolean getBool() {
return bool;
}
@Override
public String from(String targetPropertyAccessor, Type type) {
return "Integer.parseInt( " + targetPropertyAccessor + " )";
public void setBool(boolean bool) {
this.bool = bool;
}
}

View File

@ -0,0 +1,32 @@
/**
* Copyright 2012-2013 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.test.conversion.nativetypes;
public class BooleanTarget {
private Boolean bool;
public Boolean getBool() {
return bool;
}
public void setBool(Boolean bool) {
this.bool = bool;
}
}

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ByteSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ByteTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ByteWrapperSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ByteWrapperTarget {

View File

@ -0,0 +1,55 @@
/**
* Copyright 2012-2013 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.test.conversion.nativetypes;
import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses;
import org.testng.annotations.Test;
import static org.fest.assertions.Assertions.assertThat;
@WithClasses({
CharSource.class,
CharTarget.class,
CharMapper.class
})
public class CharConversionTest extends MapperTestBase {
@Test
public void shouldApplyCharConversion() {
CharSource source = new CharSource();
source.setC( 'G' );
CharTarget target = CharMapper.INSTANCE.sourceToTarget( source );
assertThat( target ).isNotNull();
assertThat( target.getC() ).isEqualTo( Character.valueOf( 'G' ) );
}
@Test
public void shouldApplyReverseCharConversion() {
CharTarget target = new CharTarget();
target.setC( Character.valueOf( 'G' ) );
CharSource source = CharMapper.INSTANCE.targetToSource( target );
assertThat( source ).isNotNull();
assertThat( source.getC() ).isEqualTo( 'G' );
}
}

View File

@ -0,0 +1,32 @@
/**
* Copyright 2012-2013 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.test.conversion.nativetypes;
import org.mapstruct.Mapper;
import org.mapstruct.Mappers;
@Mapper
public interface CharMapper {
public static CharMapper INSTANCE = Mappers.getMapper( CharMapper.class );
CharTarget sourceToTarget(CharSource source);
CharSource targetToSource(CharTarget target);
}

View File

@ -0,0 +1,32 @@
/**
* Copyright 2012-2013 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.test.conversion.nativetypes;
public class CharSource {
private char c;
public char getC() {
return c;
}
public void setC(char c) {
this.c = c;
}
}

View File

@ -0,0 +1,32 @@
/**
* Copyright 2012-2013 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.test.conversion.nativetypes;
public class CharTarget {
private Character c;
public Character getC() {
return c;
}
public void setC(Character c) {
this.c = c;
}
}

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class DoubleSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class DoubleTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class DoubleWrapperSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class DoubleWrapperTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class FloatSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class FloatTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class FloatWrapperSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class FloatWrapperTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class IntSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class IntTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class IntWrapperSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class IntWrapperTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class LongSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class LongTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class LongWrapperSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class LongWrapperTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ShortSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ShortTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ShortWrapperSource {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
public class ShortWrapperTarget {

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapstruct.ap.test.conversion.numbers;
package org.mapstruct.ap.test.conversion.nativetypes;
import org.mapstruct.Mapper;
import org.mapstruct.Mappers;