class DataTypeResourceConverter extends ResourceConverterImpl<DataType, ClientDataType> {

    @Override
    protected ClientDataType resourceSpecificFieldsToClient(ClientDataType client, DataType serverObject, ToClientConversionOptions options) {
        ClientDataType.TypeOfDataType type;
        switch (serverObject.getDataTypeType()) {
            case DataType.TYPE_TEXT:
                type = ClientDataType.TypeOfDataType.text;
                break;
            case DataType.TYPE_DATE:
                type = ClientDataType.TypeOfDataType.date;
                break;
            case DataType.TYPE_DATE_TIME:
                type = ClientDataType.TypeOfDataType.datetime;
                break;
            case DataType.TYPE_NUMBER:
                type = ClientDataType.TypeOfDataType.number;
                break;
            case DataType.TYPE_TIME:
                type = ClientDataType.TypeOfDataType.time;
                break;
            default:
                throw new IllegalStateException("Unsupported dataType '" + serverObject.getDataTypeType() + "'");
        }
        client.setType(type);
        if (serverObject.getMaxValue() != null) {
            client.setMaxValue(dataConverterService.formatSingleValue(serverObject.getMaxValue(), serverObject, String.class));
        }
        if (serverObject.getMinValue() != null) {
            client.setMinValue(dataConverterService.formatSingleValue(serverObject.getMinValue(), serverObject, String.class));
        }
        // ignore empty string pattern
        client.setPattern("".equals(serverObject.getRegularExpr()) ? null : serverObject.getRegularExpr());
        client.setStrictMax(serverObject.isStrictMax());
        client.setStrictMin(serverObject.isStrictMin());
        client.setMaxLength(serverObject.getMaxLength());
        return client;
    }

}