 <p>If you want to create instance of your class from <code>name = Paul AND age = 16 AND country = china</code> that kind of script, then you could create yourself method</p> <pre><code>public &lt;T&gt; T builder(Class&lt;T&gt; clazz, String line) throws InstantiationException, IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException { T instance = clazz.newInstance(); String[] exps = line.split("AND"); for (String exp : exps) { String[] tokens = exp.split("=", 2); // TODO check if token has length==2 tokens[0] = tokens[0].trim(); tokens[1] = tokens[1].trim(); String methodName = "set" + (("" + tokens[0].charAt(0)).toUpperCase()) + tokens[0].substring(1); Method m1 = instance.getClass().getMethod(methodName, String.class); m1.invoke(instance, tokens[1]); } return instance; } </code></pre> <p>and when you call it <code>builder(Person.class,"name = Paul AND age = 16 AND country = china")</code> you will get instance of <code>Person</code> class with populated fields <code>name</code>, <code>age</code> and <code>country</code>.</p> <p>Is that what you are looking for?</p>