/** * Returns a list of strings with the sep as the separator of the value */ public List<String> getStringList(final String key, final String sep) { final String val = get(key); if (val == null || val.trim().length() == 0) { return Collections.emptyList(); } if (containsKey(key)) { return Arrays.asList(val.split(sep)); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
/** * Returns the int representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a int, then a parse exception * will be thrown. */ public int getInt(final String name) { if (containsKey(name)) { return Integer.parseInt(get(name).trim()); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
public Class<?> getClass(final String key, final boolean initialize, final ClassLoader cl) { try { if (containsKey(key)) { return Class.forName(get(key), initialize, cl); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } }
/** * Returns the double representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a double, then a parse exception * will be thrown. */ public double getDouble(final String name) { if (containsKey(name)) { return Double.parseDouble(get(name).trim()); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns true if the value equals "true". If the value is null, then an * UndefinedPropertyException is thrown. */ public boolean getBoolean(final String key) { if (containsKey(key)) { return "true".equalsIgnoreCase(get(key)); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
/** * Returns the uri representation of the value. If the value is null, then the default value is * returned. If the value isn't a uri, then a IllegalArgumentException will be thrown. */ public URI getUri(final String name) { if (containsKey(name)) { try { return new URI(get(name)); } catch (final URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns the long representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a long, then a parse exception * will be thrown. */ public long getLong(final String name) { if (containsKey(name)) { return Long.parseLong(get(name)); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Attempts to return the Class that corresponds to the Props value. If the class doesn't exit, an * IllegalArgumentException will be thrown. */ public Class<?> getClass(final String key) { try { if (containsKey(key)) { return Class.forName(get(key)); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } }
/** * Gets the string from the Props. If it doesn't exist, throw and UndefinedPropertiesException */ public String getString(final String key) { if (containsKey(key)) { return get(key); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
throw new UndefinedPropertyException(String.format( "Could not find variable substitution for variable(s) [%s]", StringUtils.join(visitedVariables, "->")));
public Class<?> getClass(String key, boolean initialize, ClassLoader cl) { try { if (containsKey(key)) { return Class.forName(get(key), initialize, cl); } else { throw new UndefinedPropertyException( "Missing required property '" + key + "'"); } } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e); } }
/** * Returns the int representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a int, then a parse exception * will be thrown. * * @param name the name * @return the int */ public int getInt(final String name) { if (containsKey(name)) { return Integer.parseInt(get(name).trim()); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns true if the value equals "true". If the value is null, then an * UndefinedPropertyException is thrown. * * @param key * @return */ public boolean getBoolean(String key) { if (containsKey(key)) return "true".equalsIgnoreCase(get(key)); else throw new UndefinedPropertyException("Missing required property '" + key + "'"); }
/** * Returns the double representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a double, then a parse exception * will be thrown. * * @param name the name * @return the double */ public double getDouble(final String name) { if (containsKey(name)) { return Double.parseDouble(get(name).trim()); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns the double representation of the value. If the value is null, * then a UndefinedPropertyException will be thrown. If the value isn't a * double, then a parse exception will be thrown. * * @param key * @return */ public double getDouble(String name) { if (containsKey(name)) { return Double.parseDouble(get(name).trim()); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns true if the value equals "true". If the value is null, then an * UndefinedPropertyException is thrown. * * @param key the key * @return the boolean */ public boolean getBoolean(final String key) { if (containsKey(key)) { return "true".equalsIgnoreCase(get(key)); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
/** * Returns the long representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a long, then a parse exception * will be thrown. * * @param name the name * @return the long */ public long getLong(final String name) { if (containsKey(name)) { return Long.parseLong(get(name)); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns the long representation of the value. If the value is null, then * a UndefinedPropertyException will be thrown. If the value isn't a long, * then a parse exception will be thrown. * * @param key * @return */ public long getLong(String name) { if (containsKey(name)) { return Long.parseLong(get(name)); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Gets the string from the Props. If it doesn't exist, throw and UndefinedPropertiesException * * @param key the key * @return the string */ public String getString(final String key) { if (containsKey(key)) { return get(key); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
/** * Gets the string from the Props. If it doesn't exist, throw and * UndefinedPropertiesException * * @param key * @param defaultValue * @return */ public String getString(String key) { if (containsKey(key)) { return get(key); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }