We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have this to create random data but it only does simple fields. Not any complex child objects.
public final class RandomObjectGenerator { private RandomObjectGenerator() { } public static <T> T random(Class<T> clazz) { PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); T instance = RandomFactory.getRandomValue(clazz); pojoClass.getPojoFields().stream().filter(RandomObjectGenerator::canSet).forEach((pojoField) -> { pojoField.set(instance, RandomFactory.getRandomValue(pojoField)); }); return instance; } private static boolean canSet(PojoField pojoField) { return !pojoField.isFinal() && !pojoField.isStatic() && !pojoField.isSynthetic(); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have this to create random data but it only does simple fields. Not any complex child objects.
The text was updated successfully, but these errors were encountered: