title: Grails controller, Command Object explotion
body: <p>In Grails controller actions, for validations, We use command objects. The problem is the number of CommandObject classes have exploded. </p>
  
  <pre><code> def publish = { PublishCommand command -&gt;
          if (command.hasErrors()) {
              return redirect(action: 'errors',params:params)
          }
          //rest of the code
    }
   ......
  
  Class PublishCommand {
     long personId
     String name
     static constraints = {
          personId(nullable: false, blank: false)
          name(nullable: false, blank: false)
  
     }
  }
  </code></pre>
  
  <p>PublishCommand Class exists only for this databinding &amp; validation purpose. Number of such classes have exploded, 1 created for each of the action of the application.
  Question is, Is there a way I can have this PublishCommand as innerClass? Or other ways where I don't have to create so many classes?</p>