/** * Converts value to a specific type using an optional formatter. * * @param targetClazz * the target type to convert to * @param value * the value to convert * @param formatterUpl * the formatter UPL descriptor if any * @return the converted value * @throws UnifyException * if an error occurs */ protected <T> T convert(Class<T> targetClazz, Object value, String formatterUpl) throws UnifyException { if (formatterUpl == null) { return DataUtils.convert(targetClazz, value, null); } else { return DataUtils.convert(targetClazz, value, getSessionLocaleFormatter(formatterUpl)); } }
/** * Converts value to a specific collection type using an optional formatter. * * @param collectionClazz * the target collection type to convert to * @param dataClass * the collation data type * @param value * the value to convert * @param formatterUpl * the formatter UPL descriptor if any * @return the converted value * @throws UnifyException * if an error occurs */ protected <T, U extends Collection<T>> U convert(Class<U> collectionClazz, Class<T> dataClass, Object value, String formatterUpl) throws UnifyException { if (formatterUpl == null) { return DataUtils.convert(collectionClazz, dataClass, value, null); } else { return DataUtils.convert(collectionClazz, dataClass, value, getSessionLocaleFormatter(formatterUpl)); } }