class ClientTimestamp extends ClientLiteral<Timestamp, ClientTimestamp> {

    @Override
    public String toString() {

        final String resultFormat;
        String formattedValue;
        final Timestamp value = getValue();
        try {
            formattedValue = TIMESTAMP_ADAPTER.marshal(value);
        } catch (Exception e) {
            formattedValue = ClientExpressions.MISSING_REPRESENTATION;
        }

        String preciselyMidnightRegex = "(00:?){3}(\\.0+)?$";
        // This matches any date that ends with 00:00:00 or 00:00:00.0 (or .00, .000...)
        if (Pattern.matches("[\\d-T\\s]*" + preciselyMidnightRegex, formattedValue)) {
            // If we find precise midnight, we will remove it and any leading T or space character
            // commonly found in ISO8601 or the format used by DomEL
            resultFormat = formattedValue.replaceFirst("[\\sT]" + preciselyMidnightRegex, "");

        // If the time is not 00:00:00, but we do have .000 milliseconds, lets make sure to shave them off as DomEL does
        } else if (formattedValue.contains(".") && Pattern.matches("[\\d-T\\s:]*(\\.0+)?$", formattedValue)) {
            resultFormat = formattedValue.substring(0, formattedValue.indexOf("."));
        } else {
            resultFormat = formattedValue;
        }
        return "ts'" + resultFormat + "'";
    }

    public  ClientTimestamp();
    public  ClientTimestamp(Timestamp timestamp);
    public  ClientTimestamp(ClientTimestamp t);

}