title: Conversion from string to generic type
body: <p>I need to convert string to variable value. I found solution only for C#. I need it in Java.</p>
  
  <pre><code>public class Property&lt;T&gt; {
  
      T value;
  
      public void setValue(String input){
          if(value instanceof String){
             value= input; // value is type of T not type of string (compilation error)
                           // incompatible types: String cannot be converted to T
          }
          if(value instanceof int){
             //parse string
          }
          if(value instanceof boolean){
             //parse string
          }
          ...
      }
  }
  </code></pre>