private Object parsePrimitive ( Class < ? > objectType , final String serializedObject ) { Object res = null ; if ( Boolean . class . isAssignableFrom ( objectType ) ) { res = Boolean . valueOf ( serializedObject ) ; } else if ( String . class . isAssignableFrom ( objectType ) ) { res = serializedObject ; } else if ( Character . class . isAssignableFrom ( objectType ) ) { res = Character . valueOf ( serializedObject . charAt ( 0 ) ) ; } else if ( Byte . class . isAssignableFrom ( objectType ) ) { res = Byte . parseByte ( serializedObject ) ; } else if ( Short . class . isAssignableFrom ( objectType ) ) { res = Short . parseShort ( serializedObject ) ; } else if ( Integer . class . isAssignableFrom ( objectType ) ) { res = Integer . parseInt ( serializedObject ) ; } else if ( Long . class . isAssignableFrom ( objectType ) ) { res = Long . parseLong ( serializedObject ) ; } else if ( Float . class . isAssignableFrom ( objectType ) ) { res = Float . parseFloat ( serializedObject ) ; } else if ( Double . class . isAssignableFrom ( objectType ) ) { res = Double . parseDouble ( serializedObject ) ; } return res ; }
Parse primitive serialized object .