private static Object parseData ( String str ) { if ( str . equals ( "true" ) ) { return true ; } else if ( str . equals ( "false" ) ) { return false ; } else if ( Character . isDigit ( str . charAt ( 0 ) ) ) { // number return Integer . parseInt ( str ) ; } else { return str ; } }
Parse a given string representing a data value into an instance of Data .