title: Saving values of different types, with methods
body: <p>I was to save some configuration values. :)
  These values are might be defined in a xml file and might be of the types String, boolean, String[], ...
  or others. These values might be defined in a xml file. 
  Is there a best practise way to save these values, together with their tagname in the xml file and a default value.
  I want to clean up some ultra bad legacy code, where things look like this:</p>
  
  <pre><code>    public static final String VIEWCOOKIE_MAXLENGTH_VALUENAME = "view_cookie_max_length";
      public static final int VIEWCOOKIE_MAXLENGTH_DEFAULT = 512;
      public static int viewCookie_maxLength = VIEWCOOKIE_MAXLENGTH_DEFAULT;
  
      Integer temInt = basic.getTimedBaseIntegerValue(basic.c_adclear_section, null,
      CookieValues.VIEWCOOKIE_MAXLENGTH_VALUENAME,
      CookieValues.VIEWCOOKIE_MAXLENGTH_DEFAULT, currentTime);
  if (firstLoad || basic.checkParamChanged(0,CookieValues.VIEWCOOKIE_MAXLENGTH_VALUENAME,
  CookieValues.viewCookie_maxLength, temInt))
      CookieValues.viewCookie_maxLength = temInt;
  </code></pre>
  
  <p>those lines for all values, and methods for all the different type. </p>
  
  <p>Is there a better way like this:</p>
  
  <pre><code>public class Value&lt;T&gt; {
  
     String valueName;
     final T defaultValue;
     T value;
     Method method;
      ...
  }
  </code></pre>
  
  <p>but I don't know if this is the best way and also I'm a little bit worried, because I don't want to slow down the server, due to all the Wrapppers. This problem is hard to search so I'm sorry if this has already been asked somewhere. </p>