All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jxls.common.Context Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
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;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy