class DataTypeResourceConverter extends ResourceConverterImpl<DataType, ClientDataType> {

    @Override
    protected DataType resourceSpecificFieldsToServer(ClientDataType clientObject, DataType resultToUpdate, List<Exception> exceptions, ToServerConversionOptions options) throws IllegalParameterValueException {
        byte type;
        if (clientObject.getType() != null) {
            switch (clientObject.getType()) {
                case text:
                    resultToUpdate.setDataTypeType(DataType.TYPE_TEXT);
                    resultToUpdate.setRegularExpr(clientObject.getPattern());
                    resultToUpdate.setMaxLength(clientObject.getMaxLength());
                    break;
                case date:
                    resultToUpdate.setDataTypeType(DataType.TYPE_DATE);
                    setNumbers(clientObject, resultToUpdate);
                    break;
                case datetime:
                    resultToUpdate.setDataTypeType(DataType.TYPE_DATE_TIME);
                    setNumbers(clientObject, resultToUpdate);
                    break;
                case number:
                    resultToUpdate.setDataTypeType(DataType.TYPE_NUMBER);
                    setNumbers(clientObject, resultToUpdate);
                    break;
                case time:
                    resultToUpdate.setDataTypeType(DataType.TYPE_TIME);
                    setNumbers(clientObject, resultToUpdate);
                    break;
            }
        } else {
            // to get validation error later, because user did not specified type, which is mandatory
            resultToUpdate.setDataTypeType((byte) 0);
        }
        return resultToUpdate;
    }

}