com.relogiclabs.json.schema.tree.ReceiverRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of relogiclabs-json-schema Show documentation
Show all versions of relogiclabs-json-schema Show documentation
The New JSON Schema prioritizes simplicity, conciseness, and readability, making
it user-friendly and accessible without the need for extensive prior knowledge.
It offers efficient read-write facilities, precise JSON document definition
through various data types and functions, and extensibility to meet modern web
service diverse requirements.
package com.relogiclabs.json.schema.tree;
import com.relogiclabs.json.schema.type.JNode;
import com.relogiclabs.json.schema.type.JReceiver;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class ReceiverRegistry implements Iterable>> {
private final Map> receivers;
public ReceiverRegistry() {
this.receivers = new HashMap<>();
}
public void register(List list) {
for(var r : list) receivers.put(r, new ArrayList<>());
}
public void receive(List list, JNode node) {
for(var r : list) receivers.get(r).add(node);
}
public List fetch(JReceiver receiver) {
return receivers.get(receiver);
}
public void clear() {
for(var v : receivers.values()) v.clear();
}
@Override
public Iterator>> iterator() {
return receivers.entrySet().iterator();
}
}