org.jxls.common.Context 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.common;
import java.util.HashMap;
import java.util.Map;
/**
* Map bean context
* Date: Nov 2, 2009
* @author Leonid Vysochyn
*/
public class Context {
protected Map varMap = new HashMap();
private Config config = new Config();
public Context() {
}
public Context(Map varMap) {
for (Map.Entry entry : varMap.entrySet()) {
this.varMap.put(entry.getKey(), entry.getValue());
}
}
public Map toMap(){
return varMap;
}
public Object getVar(String name){
if( varMap.containsKey(name) ) return varMap.get(name);
else return null;
}
public void putVar(String name, Object value) {
varMap.put(name, value);
}
public void removeVar(String var) {
varMap.remove(var);
}
public Config getConfig() {
return config;
}
@Override
public String toString() {
return "Context" +
varMap;
}
/**
* Special config class to use in Area processing
*/
public class Config {
private boolean ignoreSourceCellStyle = false;
private Map cellStyleMap = new HashMap<>();
private boolean isFormulaProcessingRequired = true;
public boolean isFormulaProcessingRequired() {
return isFormulaProcessingRequired;
}
public void setIsFormulaProcessingRequired(boolean isFormulaProcessingRequired) {
this.isFormulaProcessingRequired = isFormulaProcessingRequired;
}
public boolean isIgnoreSourceCellStyle() {
return ignoreSourceCellStyle;
}
public void setIgnoreSourceCellStyle(boolean ignoreSourceCellStyle) {
this.ignoreSourceCellStyle = ignoreSourceCellStyle;
}
public Map getCellStyleMap() {
return cellStyleMap;
}
public void setCellStyleMap(Map cellStyleMap) {
this.cellStyleMap = cellStyleMap;
}
}
}