/** * Convert to double. This default implementation is based on {@code Double.parseDouble(String)}. * @return double representation of the converted value * @throws NumberFormatException */ public double toDouble() { return Double.parseDouble(toString()); }
/** * Convert to decimal. This default implementation is based on {@code new BigDecimal(String)}. * @return decimal representation of the converted value * @throws NumberFormatException */ public BigDecimal toDecimal() { return new BigDecimal(toString()); } }
/** * Convert to double. This default implementation is based on {@code Double.parseDouble(String)}. * @return double representation of the converted value * @throws NumberFormatException */ public double toDouble() { return Double.parseDouble(toString()); }
/** * Convert to long. This default implementation is based on {@code Long.parseLong(String)}. * @return long representation of the converted value * @throws NumberFormatException */ public long toLong() { return Long.parseLong(toString()); }
/** * Convert to binary. This default implementation returns an new instance * of {@link StringBasedBlob}. * @return binary representation of the converted value */ public Blob toBinary() { return new StringBasedBlob(toString()); }
@Override public String apply(T value) { return getConverter(value).toString(); } });
@Override public String apply(T value) { return getConverter(value).toString(); } });
@Override public String apply(T value) { return getConverter(value).toString(); } });
/** * Convert to decimal. This default implementation is based on {@code new BigDecimal(String)}. * @return decimal representation of the converted value * @throws NumberFormatException */ public BigDecimal toDecimal() { return new BigDecimal(toString()); } }
/** * Convert to binary. This default implementation returns an new instance * of {@link StringBasedBlob}. * @return binary representation of the converted value */ public Blob toBinary() { return new StringBasedBlob(toString()); }
@Override public String apply(T value) { return getConverter(value).toString(); } });
@Override public String apply(T value) { return getConverter(value).toString(); } });
@Override public String apply(T value) { return getConverter(value).toString(); } });
@Override public String apply(T value) { return getConverter(value).toString(); } });
/** * Convert to boolean. This default implementation is based on {@code Boolean.parseBoolean(String)}. * @return boolean representation of the converted value */ public boolean toBoolean() { return Boolean.parseBoolean(toString()); }
/** * Convert to date. This default implementation is based on {@code ISO8601.parse(String)}. * @return date representation of the converted value * @throws IllegalArgumentException if the string cannot be parsed into a date */ public Calendar toCalendar() { Calendar date = ISO8601.parse(toString()); if (date == null) { throw new IllegalArgumentException("Not a date string: " + toString()); } return date; }
@Override public String apply(T value) { return getConverter(value).toString(); } });
/** * Convert to date. This default implementation is based on {@code ISO8601.parse(String)}. * @return date representation of the converted value * @throws IllegalArgumentException if the string cannot be parsed into a date */ public Calendar toCalendar() { Calendar date = ISO8601.parse(toString()); if (date == null) { throw new IllegalArgumentException("Not a date string: " + toString()); } return date; }
@Override public String apply(T value) { return getConverter(value).toString(); } });
@Override public String apply(T value) { return getConverter(value).toString(); } });