code: @PublicEvolving
  	public static List<Field> getAllDeclaredFields(Class<?> clazz, boolean ignoreDuplicates) {
  		List<Field> result = new ArrayList<Field>();
  		while (clazz != null) {
  			Field[] fields = clazz.getDeclaredFields();
  			for (Field field : fields) {
  				if(Modifier.isTransient(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) {
  					continue; // we have no use for transient or static fields
  				}
  				if(hasFieldWithSameName(field.getName(), result)) {
  					if (ignoreDuplicates) {
  						continue;
  					} else {
  						throw new InvalidTypesException("The field "+field+" is already contained in the hierarchy of the "+clazz+"."
  							+ "Please use unique field names through your classes hierarchy");
  					}
  				}
  				result.add(field);
  			}
  			clazz = clazz.getSuperclass();
  		}
  		return result;
  	}
docs: Recursively determine all declared fields
  This is required because class.getFields() is not returning fields defined
  in parent classes.
  
  @param clazz class to be analyzed
  @param ignoreDuplicates if true, in case of duplicate field names only the lowest one
  in a hierarchy will be returned; throws an exception otherwise
  @return list of fields