public DateString2DurationConverter() { super( new String2DateConverter<Date>(), new Date2DurationConverter() ); }
public Int2DateConverter() { super(new NumberToNumberConverter<Integer, Long>(Integer.class, Long.class), new Long2DateConverter()); }
public void setDecimalPattern(String pattern) { if (decimalConverter == null) decimalConverter = new NumberFormatter(pattern); decimalConverter.setPattern(pattern); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public BeanCSVScript(String[] propertyNames, char separator) { this.separator = separator; int length = propertyNames.length; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) propertyConverters[i] = new ToStringConverter(); this.converter = new ConverterChain( new BeanToPropertyArrayConverter(propertyNames), new ArrayConverter(Object.class, String.class, propertyConverters) ); }
public static <TT> String convert(TT source, String nullString) { if (source == null) return nullString; return singletonInstance.convert(source); }
public NumberFormatBasedConverter(Class<S> sourceType, Class<T> targetType, String pattern) { super(sourceType, targetType); setPattern(pattern); setDecimalSeparator(DEFAULT_DECIMAL_SEPARATOR); setGroupingSeparator(DEFAULT_GROUPING_SEPARATOR); setNullString(DEFAULT_NULL_STRING); }
private static Object[] convertArray(Object[] values, Class<?>[] targetTypes) { Object[] result = new Object[values.length]; for (int i = 0; i < values.length; i++) result[i] = AnyConverter.convert(values[i], targetTypes[i]); return result; }
@SuppressWarnings("rawtypes") public TypeConvertingExpression(Expression source, Class<E> resultType) { super("", source); this.converter = new AnyConverter<E>(resultType); }
public RegexReplacer(String pattern, String replacement) { super(String.class, String.class); setPattern(pattern); setReplacement(replacement); }
public void setGroupingSeparator(char groupingSeparator) { if (decimalConverter == null) decimalConverter = new NumberFormatter(); decimalConverter.setGroupingSeparator(groupingSeparator); }
public void setDecimalSeparator(char separator) { if (decimalConverter == null) decimalConverter = new NumberFormatter(); decimalConverter.setDecimalSeparator(separator); }
@Override @SuppressWarnings("unchecked") public E convert(String sourceValue) { return (E) convert(sourceValue, pattern, locale, targetType); }
public static ConverterManager getInstance() { if (instance == null) instance = new ConverterManager(); return instance; }
public static <SS, TT> Converter<SS, TT>[] cloneIfSupported(Converter<SS, TT>[] prototypes) { Converter[] result = new Converter[prototypes.length]; for (int i = 0; i < prototypes.length; i++) result[i] = cloneIfSupported(prototypes[i]); return result; }
public void setGroupingSeparator(char groupingSeparator) { this.groupingSeparator = groupingSeparator; updateFormat(); }
@Override public String convert(E target) throws ConversionException { return convertToString(target); }
@Override public Object convert(String sourceValue) throws ConversionException { return parse(sourceValue); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public BeanCSVScript(String[] propertyNames, char separator) { this.separator = separator; int length = propertyNames.length; Converter[] propertyConverters = new Converter[length]; for (int i = 0; i < length; i++) propertyConverters[i] = new ToStringConverter(); this.converter = new ConverterChain( new BeanToFeatureArrayConverter(propertyNames.clone()), new ArrayConverter(Object.class, String.class, propertyConverters) ); }
public void setIntegralPattern(String pattern) { if (integralConverter == null) integralConverter = new NumberFormatter(); integralConverter.setPattern(pattern); }
@SuppressWarnings({ "unchecked", "rawtypes" }) private static <T> Converter<Object, T>[] createConverters(Class<? extends T> ... elementTypes) { Converter<Object, T>[] converters = new Converter[elementTypes.length]; for (int i = 0; i < elementTypes.length; i++) converters[i] = new AnyConverter(elementTypes[i]); return converters; }