public String formatTimestamp(Timestamp timestamp) { return "'" + new TimestampFormatter(DEFAULT_TIMESTAMP_PATTERN).format(timestamp) + "'"; }
@Override public String convert(Timestamp sourceValue) throws ConversionException { return format(sourceValue); }
private Converter<?, String> createToStringConverter(Class<?> sourceType) throws ConversionException { if (sourceType.isArray()) { Class<?> componentType = sourceType.getComponentType(); if (componentType == byte.class) return new ByteArrayToBase64Converter(); else if (componentType == char.class) return new CharArray2StringConverter(); else return new FormatFormatConverter(sourceType, new ArrayFormat(), true); } else if (sourceType == Time.class) { return new FormatFormatConverter<Time>(Time.class, new SimpleDateFormat(Patterns.DEFAULT_TIME_PATTERN), false); } else if (sourceType == Timestamp.class) { return new TimestampFormatter(); } else if (sourceType == Date.class) { return new FormatFormatConverter<Time>(Time.class, new SimpleDateFormat(Patterns.DEFAULT_DATETIME_PATTERN), false); } else if (sourceType == Class.class) { return new Class2StringConverter(); } else if (Enum.class.isAssignableFrom(sourceType)) { return new Enum2StringConverter(sourceType); } else { Converter<?, String> result = tryToCreateFactoryConverter(sourceType, String.class); if (result != null) return result; else return new ToStringMethodInvoker(sourceType); } }
@Override public String formatTimestamp(Timestamp value) { String renderedTimestamp = new TimestampFormatter(TIMESTAMP_PATTERN).format(value); return MessageFormat.format(TIMESTAMP_MESSAGE, renderedTimestamp); }
String result; if (timestampPattern != null) result = new TimestampFormatter(timestampPattern).format((Timestamp) source); else result = new TimestampFormatter().format((Timestamp) source); return applyCapitalization(timestampCapitalization, result); } else if (source instanceof Time) {