![JAR search and dependency download from the Maven repository](/logo.png)
autofixture.generators.RecursionGuarded Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autofixturegenerator Show documentation
Show all versions of autofixturegenerator Show documentation
An attempt to reimplement core features of a popular .NET anonymous value generator - AutoFixture - in
Java
package autofixture.generators;
import autofixture.interfaces.*;
public class RecursionGuarded implements GeneratorsPipeline {
private final GeneratorsPipeline generatorsPipeline;
private final RecursionGuard recursionGuard;
public RecursionGuarded(final GeneratorsPipeline generatorsPipeline, final RecursionGuard recursionGuard) {
this.generatorsPipeline = generatorsPipeline;
this.recursionGuard = recursionGuard;
}
@Override
public T executeFor(final InstanceType instanceType, final FixtureContract fixture) {
try {
recursionGuard.addDepthLevelTo(instanceType);
return recursionGuard.defaultValueIfMaxDepthReachedOrGenerateUsing(generatorsPipeline, instanceType, fixture);
} finally {
recursionGuard.removeDepthLevelFor(instanceType);
}
}
@Override
public void registerCustomization(final InstanceGenerator instanceGenerator) {
generatorsPipeline.registerCustomization(instanceGenerator);
}
@Override
public void clearCustomizations() {
generatorsPipeline.clearCustomizations();
}
@Override
public void setOmittingAutoProperties(final boolean isOn) {
generatorsPipeline.setOmittingAutoProperties(isOn);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy