@Override public T generate(SourceOfRandomness random, GenerationStatus status) { Class<T> type = types().get(0); Object generated = instantiate(type); for (Field each : fields) { ParameterContext parameter = parameterContext(each); setField(each, generated, generatorFor(parameter).generate(random, status), true); } return type.cast(generated); }
public static Map<String, Object> defaultValuesOf(Class<? extends Annotation> annotation) { Map<String, Object> values = new HashMap<>(); for (Method each : annotation.getDeclaredMethods()) values.put(each.getName(), defaultValueOf(annotation, each.getName())); return values; }