private <T> T tryGet(Property<T> property, Function<String, T> converter) { String fullKeyName = this.keyPrefix + property.getName(); // Get value from config. String value = this.properties.getProperty(fullKeyName, null); if (value == null) { // 2. Nothing in the configuration for this Property. if (property.hasDefaultValue()) { return property.getDefaultValue(); } else { throw new MissingPropertyException(fullKeyName); } } try { return converter.apply(value.trim()); } catch (IllegalArgumentException ex) { throw new InvalidPropertyValueException(fullKeyName, value, ex); } }