public String get(String property, String defaultValue) { String value = properties.getProperty(property); return value != null ? log(property, value) : parent.get(property, defaultValue); }
public long get(String property, long defaultValue) { String value = properties.getProperty(property); if (value == null) return parent.get(property, defaultValue); try { return log(property, Long.parseLong(value)); } catch (NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public int get(String property, int defaultValue) { String value = properties.getProperty(property); if (value == null) return parent.get(property, defaultValue); try { return log(property, Integer.parseInt(value)); } catch (NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public Class get(String property, Class defaultValue) { String className = properties.getProperty(property); if (className == null) return parent.get(property, defaultValue); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { return log(property, classLoader.loadClass(className)); } catch (Exception e) { getLogger().warning("Could not load " + property + " : " + className, e); return parent.get(property, defaultValue); } }
public String get(final String property, final String defaultValue) { final String value = properties.getProperty(property); return value != null ? log(property, value) : parent.get(property, defaultValue); }
public boolean get(String property, boolean defaultValue) { String value = properties.getProperty(property); if (value == null) return parent.get(property, defaultValue); try { return log(property, Boolean.parseBoolean(value)); } catch (NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public <T extends Enum<T>> T get(String property, T defaultValue) { String value = properties.getProperty(property); if (value == null) return parent.get(property, defaultValue); if (defaultValue == null) throw new IllegalArgumentException("Must supply a default for property " + property); Class<T> enumType = (Class<T>) defaultValue.getClass(); try { return log(property, valueOf(enumType, value.toUpperCase())); } catch (IllegalArgumentException e) { warn(property, value); return parent.get(property, defaultValue); } }
public String get(final String property, final String defaultValue) { final String value = properties.getProperty(property); return value != null ? log(property, value) : parent.get(property, defaultValue); }
public long get(final String property, final long defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { return log(property, Long.parseLong(value)); } catch (final NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public int get(final String property, final int defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { return log(property, Integer.parseInt(value)); } catch (final NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public boolean get(final String property, final boolean defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { return log(property, Boolean.parseBoolean(value)); } catch (final NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public int get(final String property, final int defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { return log(property, Integer.parseInt(value)); } catch (final NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public boolean get(final String property, final boolean defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { return log(property, Boolean.parseBoolean(value)); } catch (final NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public Class<?> get(final String property, final Class<?> defaultValue) { final String className = properties.getProperty(property); if (className == null) { return parent.get(property, defaultValue); } final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { return log(property, classLoader.loadClass(className)); } catch (final Exception e) { getLogger().warning("Could not load " + property + " : " + className, e); return parent.get(property, defaultValue); } }
public <T extends Enum<T>> T get(final String property, final T defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } if (defaultValue == null) { throw new IllegalArgumentException("Must supply a default for property " + property); } final Class<T> enumType = (Class<T>) defaultValue.getClass(); try { return log(property, valueOf(enumType, value.toUpperCase())); } catch (final IllegalArgumentException e) { warn(property, value); return parent.get(property, defaultValue); } }
@SuppressWarnings("unchecked") public <T> T get(final String property, final T defaultValue) { if (defaultValue == null) { throw new NullPointerException("defaultValue"); } final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { final Class<?> type = defaultValue.getClass(); final Constructor<?> constructor = type.getConstructor(String.class); final T t = (T) constructor.newInstance(value); return log(property, t); } catch (final Exception e) { e.printStackTrace(); warn(property, value, e); return parent.get(property, defaultValue); } }
@SuppressWarnings("unchecked") public <T> T get(final String property, final T defaultValue) { if (defaultValue == null) { throw new NullPointerException("defaultValue"); } final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { final Class<?> type = defaultValue.getClass(); final Constructor<?> constructor = type.getConstructor(String.class); final T t = (T) constructor.newInstance(value); return log(property, t); } catch (final Exception e) { e.printStackTrace(); warn(property, value, e); return parent.get(property, defaultValue); } }
public long get(final String property, final long defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { return log(property, Long.parseLong(value)); } catch (final NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public Class<?> get(final String property, final Class<?> defaultValue) { final String className = properties.getProperty(property); if (className == null) { return parent.get(property, defaultValue); } final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { return log(property, classLoader.loadClass(className)); } catch (final Exception e) { getLogger().warning("Could not load " + property + " : " + className, e); return parent.get(property, defaultValue); } }
public <T extends Enum<T>> T get(final String property, final T defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } if (defaultValue == null) { throw new IllegalArgumentException("Must supply a default for property " + property); } final Class<T> enumType = (Class<T>) defaultValue.getClass(); try { return log(property, valueOf(enumType, value.toUpperCase())); } catch (final IllegalArgumentException e) { warn(property, value); return parent.get(property, defaultValue); } }