/** * Performs a conversion of a single value to the specified target class. * The passed in source object is guaranteed to be a single value, but it * can be <b>null</b>. Derived classes that want to extend the available * conversions, but are happy with the handling of complex objects, just * need to override this method. * * @param <T> the desired target type of the conversion * @param src the source object (a single value) * @param targetCls the target class of the conversion * @param ci the {@code ConfigurationInterpolator} (not <b>null</b>) * @return the converted value * @throws ConversionException if conversion is not possible */ protected <T> T convertValue(final Object src, final Class<T> targetCls, final ConfigurationInterpolator ci) { if (src == null) { return null; } // This is a safe cast because PropertyConverter either returns an // object of the correct class or throws an exception. @SuppressWarnings("unchecked") final T result = (T) PropertyConverter.to(targetCls, src, this); return result; }