brainslug.flow.definition.HashMapDefinitionStore Maven / Gradle / Ivy
The newest version!
package brainslug.flow.definition;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class HashMapDefinitionStore implements DefinitionStore {
Map flowDefinitions = new HashMap();
public void addDefinition(FlowDefinition flowDefinition) {
flowDefinitions.put(flowDefinition.getId(), flowDefinition);
}
@Override
public Collection getDefinitions() {
return flowDefinitions.values();
}
public FlowDefinition findById(Identifier id) {
LoggerFactory.getLogger(DefinitionStore.class).trace("flowDefinitions: " + flowDefinitions);
if (flowDefinitions.get(id) == null) {
throw new IllegalArgumentException(String.format("no flow with id %s found", id));
}
return flowDefinitions.get(id);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy