title: Java8 using enum values in interface's default methods
body: <p>I'm exploring possibilities of static and default methods introduced in java 8.</p>
  
  <p>I've an interface that has 2 default methods that do construct a command, that I run on server through ssh to do some simple tasks remotely. Moving mouse requires 2 arguments: x and y position of the mouse. </p>
  
  <pre><code>public interface Robot {
  
      default String moveMouse(int x, int y) {
          return constructCmd("java -jar move_mouse.jar " + x + " " + y);
      }
  
      default String clickLeft() {
          return  constructCmd("java -jar click_left.jar");
      }
  
      static String constructCmd(String cmd) {
          return "export DISPLAY=:1.0\n" +
                  "cd Desktop\n" +
                  cmd;
      }
  } 
  </code></pre>
  
  <p>I've multiple enums with values preset, I could potently combine all enums into one and not use interface what so ever, however that enum would contain hundreds or thousands of values and I want to keep it somewhat organised, so I've split evertying in multiple enums.</p>
  
  <p>I want all enums to share same methods so I figured I'll give default methods in an interface a shot.</p>
  
  <pre><code>public enum Field implements Robot {
  
      AGE_FIELD(778, 232),
  
      NAME_FIELD(662, 280);
  
      public int x;
      public int y;
  
      Field(int x, int y) {
          this.x = x;
          this.y = y;
      }
  }
  </code></pre>
  
  <p>So I can get String commands by:</p>
  
  <pre><code>Field.AGE_FIELD.clickLeft();
  Field.AGE_FIELD.moveMouse(Field.AGE_FIELD.x, Field.AGE_FIELD.y);
  </code></pre>
  
  <p>However moveMouse looks really bad to me and I think it should be somehow possible to use enum's values by default.</p>
  
  <p>Anyone has a a nice solution for such problem?</p>