title: Generate Java methods from swagger yaml to be used with my own methods
body: <pre><code>---
  swagger: "2.0"
  
  definitions:
    Result:
      properties:
        data:
          type: string
          description: Some data result
  
    Payload:
      properties:
        id:
          required: true
          type: integer
        data:
          required: true
          type: string
  </code></pre>
  
  <p>After I have generated the Swagger POJOs I create in a method in a class like this.</p>
  
  <pre><code> public Result sendMessage(int id, String data) throws IOException {
          return some_clazz.go(
                  Result.class,
                  new Payload().id(id).data(data)
          );
      }
  </code></pre>
  
  <p>The problem is that I have many different definitions and I am pretty much just duplicating the pattern since each of them use the common <code>some_clazz.go</code> method (note: some_clazz uses <code>genetics</code> hence the first arg). For example:</p>
  
  <pre><code> public AnotherResult sendMessage(int id) throws IOException {
          return some_clazz.go(
                  AnotherResult.class,
                  new DifferentPayload().id(id)
          );
      }
  </code></pre>
  
  <p>Is there a way for swagger (or something else) to generate classes and methods from my definitions that can be passed to <code>some_clazz.go</code>?</p>