protected Number parseNumber ( String text ) { if ( INTEGER_PATTERN . matcher ( text ) . matches ( ) ) { return Integer . parseInt ( text ) ; } if ( DOUBLE_PATTERN . matcher ( text ) . matches ( ) ) { return Double . parseDouble ( text ) ; } if ( FLOAT_PATTERN . matcher ( text ) . matches ( ) ) { return Float . parseFloat ( text ) ; } return null ; }
Parses a number that matches the text null if no matches