public class ReflectionUtils {
/**
* The method takes "Class", the name of the field and returns "Field".
*
* @param className incoming parameter
* @param fieldName incoming parameter
* @return "Field"
*/
public Field getFieldFromName(Class className, String fieldName) {
try {
Field field = className.getDeclaredField(fieldName);
return field;
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
}