 <p>Basic implementation</p> <pre><code>public abstract class Field&lt;T&gt; { private T value; // + constructor(s) public T get() { return value; } public void set(T value) { this.value = value; } } public class StringField extends Field&lt;String&gt;{} public class IntField extends Field&lt;Integer&gt;{} </code></pre> <p>for more details Please visit this <a href="http://docs.oracle.com/cd/E19206-01/816-4178/dynamic-10/index.html" rel="nofollow">link</a> <a href="http://tutorials.jenkov.com/java-reflection/getters-setters.html" rel="nofollow">link2</a></p>