if ( valueType == ValueType.NULL_TYPE ) {
field = new ObjectFieldImpl( null );
} else if ( valueType == ValueType.PCHAR_TYPE || valueType == ValueType.CHAR_TYPE) {
if( value instanceof String && ((String)value).length() == 1 ) {
field = new LongFieldImpl( ((String) value).charAt(0) );
} else {
field = new LongFieldImpl( ((Character) value).charValue() );
}
} else if ( valueType == ValueType.PBYTE_TYPE || valueType == ValueType.BYTE_TYPE ) {
if( value instanceof String ) {
field = new LongFieldImpl( Byte.parseByte( (String) value) );
} else {
field = new LongFieldImpl( ((Number) value).byteValue() );
}
} else if ( valueType == ValueType.PSHORT_TYPE || valueType == ValueType.SHORT_TYPE ) {
if( value instanceof String ) {
try {
field = new LongFieldImpl( NumberFormat.getInstance().parse( (String) value ).shortValue() );
} catch ( ParseException e ) {
throw new NumberFormatException( "Error parsing number '"+value+"'" );
}
} else {
field = new LongFieldImpl( ((Number) value).shortValue() );
}
} else if ( valueType == ValueType.PINTEGER_TYPE || valueType == ValueType.INTEGER_TYPE ) {
if( value instanceof String ) {
try {
field = new LongFieldImpl( NumberFormat.getInstance().parse( (String) value ).intValue() );
} catch ( ParseException e ) {
throw new NumberFormatException( "Error parsing number '"+value+"'" );
}
} else {
field = new LongFieldImpl( ((Number) value).intValue() );
}
} else if ( valueType == ValueType.PLONG_TYPE || valueType == ValueType.LONG_TYPE ) {
if( value instanceof String ) {
try {
field = new LongFieldImpl( NumberFormat.getInstance().parse( (String) value ).longValue() );
} catch ( ParseException e ) {
throw new NumberFormatException( "Error parsing number '"+value+"'" );
}
} else {
field = new LongFieldImpl( ((Number) value).longValue() );
}
} else if ( valueType == ValueType.PFLOAT_TYPE || valueType == ValueType.FLOAT_TYPE ) {
if( value instanceof String ) {
try {
field = new DoubleFieldImpl( NumberFormat.getInstance().parse( (String) value ).floatValue() );