@Override public <T> T to(final Object src, final Class<T> targetCls, final ConfigurationInterpolator ci) { final ConfigurationInterpolator interpolator = fetchInterpolator(ci); return convert(interpolator.interpolate(src), targetCls, interpolator); }
/** * {@inheritDoc} This implementation extracts all values stored in the * passed in source object, converts them to the target type, and adds them * to the target collection. The target collection must not be <b>null</b>. * If the source object is <b>null</b>, nothing is added to the collection. * * @throws IllegalArgumentException if the target collection is <b>null</b> */ @Override public <T> void toCollection(final Object src, final Class<T> elemClass, final ConfigurationInterpolator ci, final Collection<T> dest) { if (dest == null) { throw new IllegalArgumentException( "Target collection must not be null!"); } if (src != null && !isEmptyElement(src)) { final ConfigurationInterpolator interpolator = fetchInterpolator(ci); convertToCollection(src, elemClass, interpolator, dest); } }
/** * {@inheritDoc} This implementation extracts all values stored in the * passed in source object, converts them to the target type, and adds them * to a result array. Arrays of objects and of primitive types are * supported. If the source object is <b>null</b>, result is <b>null</b>, * too. */ @Override public Object toArray(final Object src, final Class<?> elemClass, final ConfigurationInterpolator ci) { if (src == null) { return null; } if (isEmptyElement(src)) { return Array.newInstance(elemClass, 0); } final ConfigurationInterpolator interpolator = fetchInterpolator(ci); return elemClass.isPrimitive() ? toPrimitiveArray(src, elemClass, interpolator) : toObjectArray(src, elemClass, interpolator); }