private Optional<OrderField<?>> getOrderField(final Map<String, Field<?>> fieldMap,
                                                  final CriteriaFieldSort sort) {
        final Field<?> field = fieldMap.get(sort.getId());

        if (field != null) {
            if (sort.isDesc()) {
                return Optional.of(field.desc());
            } else {
                return Optional.of(field.asc());
            }
        }

        return Optional.empty();
    }
Used to build jOOQ conditions from string criteria

@param field    The jOOQ field being queried
@param criteria The criteria to apply
@return A condition that applies the given criteria
stroom-db-util/src/main/java/stroom/db/util/JooqHelper.java