io.legaldocml.xpath.cerebro.CerebroDefinition Maven / Gradle / Ivy
package io.legaldocml.xpath.cerebro;
import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.AknObject;
public final class CerebroDefinition {
private final ImmutableMap, CerebroLink> links;
public CerebroDefinition(CerebroLink... cerebroLinks) {
this(null, cerebroLinks);
}
public CerebroDefinition(CerebroDefinition parent, CerebroLink... cerebroLinks) {
ImmutableMap.Builder builder = ImmutableMap., CerebroLink>builder();
if (parent != null) {
builder.putAll(parent.links);
}
for (CerebroLink link : cerebroLinks) {
builder.put(link.getAknClass(), link);
}
this.links = builder.build();
}
public CerebroLink getLink(Class extends AknObject> child) {
return links.get(child);
}
}