public float getAsFloat ( String attribute ) { String value = getAttribute ( attribute ) ; if ( value == null ) { return 0 ; } try { return Float . parseFloat ( value ) ; } catch ( NumberFormatException e ) { throw new RuntimeException ( "Attribute " + attribute + " is not specified as a float:" + getAttribute ( attribute ) ) ; } }
Get an attribute converted to a float value