title: Dynamic constructor structure for custom Java Class
body: <p>I'd like to create a class with about 60 fields of type double inside.  Then I need to create different instances of this class, valuing through the constructor only some of these fields (about 4-5 fields), leaving the others as default (0).</p>
  
  <p>The problem is that I don't want to have a 60 parameters constructor, since it would be a waste of time to fill all the required fields. Furthermore, I don't want to create public methods to set fields value one by one.</p>
  
  <p>I was thinking about java Annotation, somenthing like</p>
  
  <pre><code>public @interface MyAnnotation{
  
      public double f1() default 0;
      public double f2() default 0;
      public double f3() default 0;
      ...
      public double f60() default 0;
  
  }
  </code></pre>
  
  <p>so that I can then specify only the parameters I need</p>
  
  <pre><code>@MyAnnotation(f1=2.1 , f48=3.5)
  </code></pre>
  
  <p>Anyway, I don't have much experience on that and I'm not sure it can cope with my needs. Broadly speaking, my object would be to have something like:</p>
  
  <pre><code>MyClass c1 = new MyClass(f1=2.1 , f48=3.5);
  MyClass c2 = new MyClass(f4=5 , f30=12.9);
  
  public class MyClass{
      double f1;
      double f2;
      double f3;
      ...
      double f60;
  }
  </code></pre>
  
  <p>Is there a way to get somenthing similar also with class constructors?</p>
  
  <p>P.S. I'm not a programmer but I'm quite aware of Java reflections, so no problem if they would be required.</p>