/** * Convert the specified input object into an output object of the * specified type. * * @param <T> Target type of the conversion. * @param type Data type to which this value should be converted. * @param value The input value to be converted. * @return The converted value. * @throws Throwable if an error occurs converting to the specified type * @since 1.8.0 */ @Override protected <T> T convertToType(final Class<T> type, final Object value) throws Throwable { // We have to support Object, too, because this class is sometimes // used for a standard to Object conversion if (String.class.equals(type) || Object.class.equals(type)) { return type.cast(value.toString()); } throw conversionException(type, value); }
register(Long.class, throwException ? new LongConverter() : new LongConverter(defaultNumber)); register(Short.class, throwException ? new ShortConverter() : new ShortConverter(defaultNumber)); register(String.class, throwException ? new StringConverter() : new StringConverter(stringDefault));
register(Long.class, throwException ? new LongConverter() : new LongConverter(defaultNumber)); register(Short.class, throwException ? new ShortConverter() : new ShortConverter(defaultNumber)); register(String.class, throwException ? new StringConverter() : new StringConverter(stringDefault));
registerArrayConverter(Long.class, new LongConverter(), throwException, defaultArraySize); registerArrayConverter(Short.class, new ShortConverter(), throwException, defaultArraySize); registerArrayConverter(String.class, new StringConverter(), throwException, defaultArraySize);
/** * Convert the specified input object into an output object of the * specified type. * * @param <T> Target type of the conversion. * @param type Data type to which this value should be converted. * @param value The input value to be converted. * @return The converted value. * @throws Throwable if an error occurs converting to the specified type * @since 1.8.0 */ @Override protected <T> T convertToType(final Class<T> type, final Object value) throws Throwable { // We have to support Object, too, because this class is sometimes // used for a standard to Object conversion if (String.class.equals(type) || Object.class.equals(type)) { return type.cast(value.toString()); } throw conversionException(type, value); }
registerArrayConverter(Long.class, new LongConverter(), throwException, defaultArraySize); registerArrayConverter(Short.class, new ShortConverter(), throwException, defaultArraySize); registerArrayConverter(String.class, new StringConverter(), throwException, defaultArraySize);
/** * Convert the specified input object into an output object of the * specified type. * * @param <T> Target type of the conversion. * @param type Data type to which this value should be converted. * @param value The input value to be converted. * @return The converted value. * @throws Throwable if an error occurs converting to the specified type * @since 1.8.0 */ @Override protected <T> T convertToType(final Class<T> type, final Object value) throws Throwable { // We have to support Object, too, because this class is sometimes // used for a standard to Object conversion if (String.class.equals(type) || Object.class.equals(type)) { return type.cast(value.toString()); } throw conversionException(type, value); }
ArrayConverter arrayConverter = new ArrayConverter(String[].class, new StringConverter()); arrayConverter.setDelimiter(','); convertUtilsBean.register(arrayConverter, String[].class);
register(Long.class, throwException ? new LongConverter() : new LongConverter(defaultNumber)); register(Short.class, throwException ? new ShortConverter() : new ShortConverter(defaultNumber)); register(String.class, throwException ? new StringConverter() : new StringConverter(stringDefault));
register(Long.class, throwException ? new LongConverter() : new LongConverter(defaultNumber)); register(Short.class, throwException ? new ShortConverter() : new ShortConverter(defaultNumber)); register(String.class, throwException ? new StringConverter() : new StringConverter(stringDefault));
register(Long.class, throwException ? new LongConverter() : new LongConverter(defaultNumber)); register(Short.class, throwException ? new ShortConverter() : new ShortConverter(defaultNumber)); register(String.class, throwException ? new StringConverter() : new StringConverter(stringDefault));
register(Long.class, throwException ? new LongConverter() : new LongConverter(defaultNumber)); register(Short.class, throwException ? new ShortConverter() : new ShortConverter(defaultNumber)); register(String.class, throwException ? new StringConverter() : new StringConverter(stringDefault));
registerArrayConverter(Long.class, new LongConverter(), throwException, defaultArraySize); registerArrayConverter(Short.class, new ShortConverter(), throwException, defaultArraySize); registerArrayConverter(String.class, new StringConverter(), throwException, defaultArraySize);
registerArrayConverter(Long.class, new LongConverter(), throwException, defaultArraySize); registerArrayConverter(Short.class, new ShortConverter(), throwException, defaultArraySize); registerArrayConverter(String.class, new StringConverter(), throwException, defaultArraySize);
registerArrayConverter(Long.class, new LongConverter(), throwException, defaultArraySize); registerArrayConverter(Short.class, new ShortConverter(), throwException, defaultArraySize); registerArrayConverter(String.class, new StringConverter(), throwException, defaultArraySize);
registerArrayConverter(Long.class, new LongConverter(), throwException, defaultArraySize); registerArrayConverter(Short.class, new ShortConverter(), throwException, defaultArraySize); registerArrayConverter(String.class, new StringConverter(), throwException, defaultArraySize);