title: jooq use custom function in order by statement
body: <p>I'm currently trying to introduce this function  <a href="https://stackoverflow.com/a/12257917/4375998">https://stackoverflow.com/a/12257917/4375998</a> into my project, but struggle with the function signature generated by jooq.</p>
  <p>The generated code has these three signatures</p>
  <pre><code>public static String udfNaturalsortformat(
        Configuration configuration
      , String instring
      , Integer numberlength
      , String sameorderchars
  )
  
  public static Field&lt;String&gt; udfNaturalsortformat(
        String instring
      , Integer numberlength
      , String sameorderchars
  )
  
  public static Field&lt;String&gt; udfNaturalsortformat(
        Field&lt;String&gt; instring
      , Field&lt;Integer&gt; numberlength
      , Field&lt;String&gt; sameorderchars
  )
  </code></pre>
  <p>But none of them seem to fit my use case of ordering a table by name.</p>
  <p>This is currently done in the following fashion: In some place a collection of search parameters is generated and this is later included in the query:</p>
  <pre><code>public Collection&lt;? extends SortField&lt;?&gt;&gt; getSortFields(List&lt;Pageable.SortField&gt; sorts) {
          if (sorts.isEmpty()) {
              return Collections.singletonList(ProjectRepositoryImpl.LAST_ACTIVITY.field(&quot;last_activity&quot;).desc());
          }
          List&lt;SortField&lt;?&gt;&gt; sortFields = new ArrayList&lt;&gt;();
          for (Pageable.SortField sort : sorts) {
              if (sort.getSortDirection() == Pageable.SortDirection.DESC) {
                  sortFields.add(PROJECT.NAME.desc());
              } else {
                  sortFields.add(PROJECT.NAME.asc());
              }
          }
  
          return sortFields;
  }
  </code></pre>
  <p>And the final query then looks like this</p>
  <pre><code>        Result&lt;Record&gt; queryResults = jooq.select(PROJECT.fields())
                  .from(PROJECT)
                  .where(searchCondition)
                  .orderBy(transformer.getSortFields(pageable.getSorts()))
                  .limit(pageable.getPageSize())
                  .offset(pageable.getOffset())
                  .fetch();
  </code></pre>
  <p>So what I currently attempt to do is replace the sort field with something like this</p>
  <pre><code>    sortFields.add(udfNaturalsortformat(PROJECT.NAME, 10, &quot;.&quot;).desc());
  </code></pre>
  <p>but the signature mismatches.</p>
  <p>What is the proper way to include this method in my order by statement?</p>