private static Object decode ( Class < ? > type , String value ) throws Exception { if ( type . getName ( ) . equals ( "java.lang.String" ) ) { return value ; } if ( type . getName ( ) . equals ( "boolean" ) ) { return Boolean . valueOf ( value ) ; } if ( type . getName ( ) . equals ( "int" ) ) { return Integer . valueOf ( value ) ; } if ( type . getName ( ) . equals ( "long" ) ) { return Long . valueOf ( value ) ; } if ( type . getName ( ) . equals ( "float" ) ) { return Float . valueOf ( value ) ; } if ( type . getName ( ) . equals ( "double" ) ) { return Double . valueOf ( value ) ; } if ( type . getName ( ) . equals ( "java.lang.Class" ) ) { return Class . forName ( value ) ; } return null ; }
Decodes a String into an object of the specified type . If the object type is not supported null will be returned .