/** * Converts a string to a {@link Float}. * * @param s * the string. * @return a {@link Float}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new Float( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to parse number", be ); } } }
/** * Converts a string to a {@link Double}. * * @param s * the string. * @return a {@link Double}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new Double( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to parse number", be ); } } }
/** * Converts a string to a {@link Integer}. * * @param s * the string. * @return a {@link Integer}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new Short( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to parse number", be ); } } }
/** * Converts a string to a {@link Integer}. * * @param s * the string. * @return a {@link Integer}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new Long( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to parse number", be ); } } }
/** * Converts a string to a {@link Byte}. * * @param s * the string. * @return a {@link Byte}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new Byte( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to parse number", be ); } } }
/** * Converts a string to a {@link Integer}. * * @param s * the string. * @return a {@link Integer}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new Integer( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to parse Number", be ); } } }
/** * Converts a string to a {@link java.math.BigInteger}. * * @param s * the string. * @return a {@link java.math.BigInteger}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new BigInteger( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to parse string as number", be ); } } }
/** * Converts a string to a {@link BigDecimal}. * * @param s * the string. * @return a {@link BigDecimal}. */ public Object toPropertyValue( final String s ) throws BeanException { if ( s == null ) { throw new NullPointerException(); } final String val = s.trim(); if ( val.length() == 0 ) { throw BeanException.getInstance( "Failed to convert empty string to number", null ); } try { return new BigDecimal( val ); } catch ( NumberFormatException be ) { throw BeanException.getInstance( "Failed to convert", be ); } } }
writeMethod.invoke( bean, new Integer( name.getIndex() ), o ); } catch ( Exception e ) { throw BeanException.getInstance( "InvokationError", e ); throw BeanException.getInstance( "Property is not writeable: " + name, null ); writeMethod.invoke( bean, o ); } catch ( Exception e ) { throw BeanException.getInstance( "InvokationError on property '" + name + "' on bean type " + bean.getClass(), e );
return readMethod.invoke( bean, new Integer( name.getIndex() ) ); } catch ( Exception e ) { throw BeanException.getInstance( "InvokationError", e ); throw BeanException.getInstance( "Property is not readable: " + name, null ); return readMethod.invoke( bean ); } catch ( Exception e ) { throw BeanException.getInstance( "InvokationError", e );