public int getInteger ( String key , int defaultValue ) { Object o = getObject ( key ) ; if ( o == null ) { return defaultValue ; } int val = defaultValue ; try { val = Integer . parseInt ( o . toString ( ) ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Object [" + o + "] associated with key [" + key + "] is not of type Integer." ) ; } return val ; }
Get the integer value or the defaultValue if not found .