/** * The toString() operation is used for debugging information. It does * not create a deep reproduction of this configuration and all child configurations, * instead it displays the name, value, and location. * * @return getName() + "::" + getValue() + ":@" + getLocation(); */ public String toString() { return getName() + "::" + getValue("<no value>") + ":@" + getLocation(); } }
"Cannot parse the value \"" + value + "\" as an integer in the configuration element \"" + getName() + "\" at " + getLocation(); throw new ConfigurationException( message );
/** * Returns the value of the attribute specified by its name as a * <code>float</code>. * * @param name the name of the attribute * @throws ConfigurationException if an error occurs * @return the value */ public float getAttributeAsFloat( final String name ) throws ConfigurationException { final String value = getAttribute( name ); try { return Float.parseFloat( value ); } catch( final Exception e ) { final String message = "Cannot parse the value \"" + value + "\" as a float in the attribute \"" + name + "\" at " + getLocation(); throw new ConfigurationException( message ); } }
"Cannot parse the value \"" + value + "\" as a long in the configuration element \"" + getName() + "\" at " + getLocation(); throw new ConfigurationException( message );
"Cannot parse the value \"" + value + "\" as an integer in the attribute \"" + name + "\" at " + getLocation(); throw new ConfigurationException( message );
"Cannot parse the value \"" + value + "\" as a long in the attribute \"" + name + "\" at " + getLocation(); throw new ConfigurationException( message );
/** * Returns the value of the attribute specified by its name as a * <code>double</code>. * * @param name the name of the attribute * @throws ConfigurationException if an error occurs * @return the value */ public double getAttributeAsDouble( final String name ) throws ConfigurationException { final String value = getAttribute( name ); try { return Double.parseDouble( value ); } catch( final Exception e ) { final String message = "Cannot parse the value \"" + value + "\" as a double in the attribute \"" + name + "\" at " + getLocation(); throw new ConfigurationException( message ); } }
/** * Returns the value of the configuration element as a <code>float</code>. * * @throws ConfigurationException if an error occurs * @return the value */ public float getValueAsFloat() throws ConfigurationException { final String value = getValue().trim(); try { return Float.parseFloat( value ); } catch( final Exception nfe ) { final String message = "Cannot parse the value \"" + value + "\" as a float in the configuration element \"" + getName() + "\" at " + getLocation(); throw new ConfigurationException( message ); } }
/** * Returns the value of the configuration element as a <code>double</code>. * * @throws ConfigurationException if an error occurs * @return the value */ public double getValueAsDouble() throws ConfigurationException { final String value = getValue().trim(); try { return Double.parseDouble( value ); } catch( final Exception nfe ) { final String message = "Cannot parse the value \"" + value + "\" as a double in the configuration element \"" + getName() + "\" at " + getLocation(); throw new ConfigurationException( message ); } }
/** * Returns the value of the configuration element as a <code>boolean</code>. * * @throws ConfigurationException if an error occurs * @return the value */ public boolean getValueAsBoolean() throws ConfigurationException { final String value = getValue().trim(); if( isTrue( value ) ) { return true; } else if( isFalse( value ) ) { return false; } else { final String message = "Cannot parse the value \"" + value + "\" as a boolean in the configuration element \"" + getName() + "\" at " + getLocation(); throw new ConfigurationException( message ); } }
/** * Returns the value of the attribute specified by its name as a * <code>boolean</code>. * * @param name the name of the attribute * @throws ConfigurationException if an error occurs * @return the value */ public boolean getAttributeAsBoolean( final String name ) throws ConfigurationException { final String value = getAttribute( name ); if( isTrue( value ) ) { return true; } else if( isFalse( value ) ) { return false; } else { final String message = "Cannot parse the value \"" + value + "\" as a boolean in the attribute \"" + name + "\" at " + getLocation(); throw new ConfigurationException( message ); } }