![JAR search and dependency download from the Maven repository](/logo.png)
autofixture.generators.enums.InMemoryEnumCache 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.enums;
import autofixture.implementationdetails.CircularList;
import autofixture.interfaces.InstanceType;
import java.util.HashMap;
import java.util.Map;
public class InMemoryEnumCache implements EnumCache {
private final Map, CircularList>> sequences = new HashMap<>();
@Override
public void registerIfNotPresent(final InstanceType instanceType) {
if (!sequences.containsKey(instanceType)) {
sequences.put(instanceType, CircularList.createFromEnum(instanceType));
}
}
@SuppressWarnings("unchecked")
@Override
public T retrieveNextValueOf(final InstanceType instanceType) {
return (T) sequences.get(instanceType).next();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy