org.jxls.builder.xml.SimpleConfigurator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jxls Show documentation
Show all versions of jxls Show documentation
Small library for Excel generation based on XLS templates
package org.jxls.builder.xml;
import ch.qos.logback.core.joran.GenericConfigurator;
import ch.qos.logback.core.joran.action.Action;
import ch.qos.logback.core.joran.action.ImplicitAction;
import ch.qos.logback.core.joran.spi.ElementSelector;
import ch.qos.logback.core.joran.spi.Interpreter;
import ch.qos.logback.core.joran.spi.RuleStore;
import java.util.List;
import java.util.Map;
/**
* Configurator used by XmlAreaBuilder to configure building rules
* @author Leonid Vysochyn
* Date: 2/14/12
*/
class SimpleConfigurator extends GenericConfigurator {
private final Map ruleMap;
private final List iaList;
SimpleConfigurator(Map ruleMap) {
this(ruleMap, null);
}
private SimpleConfigurator(Map ruleMap, List iaList) {
this.ruleMap = ruleMap;
this.iaList = iaList;
}
@Override
protected void addInstanceRules(RuleStore rs) {
for (ElementSelector pattern : ruleMap.keySet()) {
Action action = ruleMap.get(pattern);
rs.addRule(pattern, action);
}
}
@Override
protected void addImplicitRules(Interpreter interpreter) {
if(iaList == null) {
return;
}
for (ImplicitAction ia : iaList) {
interpreter.addImplicitAction(ia);
}
}
}