prompto.store.datomic.DatomicFacts Maven / Gradle / Ivy
package prompto.store.datomic;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Stream;
public class DatomicFacts {
Object dbId;
Map toAdd = new HashMap<>();
public DatomicFacts(Object dbId) {
this.dbId = dbId;
}
public Object getDbId() {
return dbId;
}
public void setDbId(Object dbId) {
this.dbId = dbId;
}
public void add(String name, Object value) {
toAdd.put(":" + name, value);
}
public Stream> getAddedFacts() {
Stream> singles = getSingleValueFacts();
Stream> multiples = getMultiValueFacts();
return Stream.concat(singles, multiples);
}
@SuppressWarnings("unchecked")
private Stream> getMultiValueFacts() {
return toAdd.entrySet().stream()
.filter(e->e.getValue() instanceof Collection)
.map(e->getMultiValueFacts(e.getKey(), (Collection
© 2015 - 2024 Weber Informatics LLC | Privacy Policy