final Enum<?> enumValue = Enum.valueOf( fieldType.asSubclass( Enum.class ), value );
field.set( obj, enumValue );
}
} else {
final CharArray object = input.getAttribute( fieldName );
if ( object != null ) {
if ( fieldType == String.class ) {
field.set( obj, getAttribute( input, fieldName, (String) null ) );
} else if ( fieldType.isAssignableFrom( Boolean.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Boolean) null ) );
field.set( obj, getAttribute( input, fieldName, (Boolean) null ) );
} else if ( fieldType.isAssignableFrom( Integer.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Integer) null ) );
} else if ( fieldType.isAssignableFrom( Long.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Long) null ) );
} else if ( fieldType.isAssignableFrom( Short.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Short) null ) );
} else if ( fieldType.isAssignableFrom( Double.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Double) null ) );
} else if ( fieldType.isAssignableFrom( Float.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Float) null ) );
} else if ( fieldType.isAssignableFrom( Byte.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Byte) null ) );
} else if ( fieldType.isAssignableFrom( Character.class ) ) {
field.set( obj, getAttribute( input, fieldName, (Character) null ) );
} else if ( Number.class.isAssignableFrom( fieldType ) ) {
@SuppressWarnings( "unchecked" )
final XMLNumberFormat<?> format = getNumberFormat( (Class<? extends Number>) fieldType );
field.set( obj, format.newInstanceFromAttribute( input, fieldName ) );
} else if ( fieldType == Currency.class ) {
field.set( obj, Currency.getInstance( object.toString() ) );
} else {
throw new IllegalArgumentException( "Not yet supported as attribute: " + fieldType );
}
}
}