ReadWorkbook.java 5.1 KB
Newer Older
Z
zhuangjiaju 已提交
1 2 3 4 5
package com.alibaba.excel.read.metadata;

import java.io.File;
import java.io.InputStream;

庄家钜's avatar
庄家钜 已提交
6 7
import javax.xml.parsers.SAXParserFactory;

8
import com.alibaba.excel.cache.ReadCache;
庄家钜's avatar
庄家钜 已提交
9
import com.alibaba.excel.cache.selector.ReadCacheSelector;
10 11
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
Z
zhuangjiaju 已提交
12 13 14 15 16
import com.alibaba.excel.support.ExcelTypeEnum;

/**
 * Workbook
 *
Z
zhuangjiaju 已提交
17
 * @author Jiaju Zhuang
Z
zhuangjiaju 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
 **/
public class ReadWorkbook extends ReadBasicParameter {
    /**
     * Excel type
     */
    private ExcelTypeEnum excelType;
    /**
     * Read InputStream
     * <p>
     * If 'inputStream' and 'file' all not empty,file first
     */
    private InputStream inputStream;
    /**
     * Read file
     * <p>
     * If 'inputStream' and 'file' all not empty,file first
     */
    private File file;
36 37
    /**
     * Mandatory use 'inputStream' .Default is false.
罗成 已提交
38 39
     * <p>
     * if false,Will transfer 'inputStream' to temporary files to improve efficiency
40 41
     */
    private Boolean mandatoryUseInputStream;
Z
zhuangjiaju 已提交
42 43 44 45 46
    /**
     * Default true
     */
    private Boolean autoCloseStream;
    /**
47 48 49
     * This object can be read in the Listener {@link AnalysisEventListener#invoke(Object, AnalysisContext)}
     * {@link AnalysisContext#getCustom()}
     *
Z
zhuangjiaju 已提交
50
     */
51 52
    private Object customObject;
    /**
庄家钜's avatar
庄家钜 已提交
53
     * A cache that stores temp data to save memory.
54 55
     */
    private ReadCache readCache;
庄家钜's avatar
庄家钜 已提交
56 57 58 59 60 61 62 63
    /**
     * Ignore empty rows.Default is true.
     */
    private Boolean ignoreEmptyRow;
    /**
     * Select the cache.Default use {@link com.alibaba.excel.cache.selector.SimpleReadCacheSelector}
     */
    private ReadCacheSelector readCacheSelector;
庄家钜's avatar
庄家钜 已提交
64 65 66 67
    /**
     * Whether the encryption
     */
    private String password;
庄家钜's avatar
庄家钜 已提交
68 69 70 71 72 73 74 75 76 77 78
    /**
     * SAXParserFactory used when reading xlsx.
     * <p>
     * The default will automatically find.
     * <p>
     * Please pass in the name of a class ,like : "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"
     *
     * @see SAXParserFactory#newInstance()
     * @see SAXParserFactory#newInstance(String, ClassLoader)
     */
    private String xlsxSAXParserFactoryName;
Z
zhuangjiaju 已提交
79 80
    /**
     * The default is all excel objects.Default is true.
罗成 已提交
81 82 83 84
     * <p>
     * if true , you can use {@link com.alibaba.excel.annotation.ExcelIgnore} ignore a field.
     * <p>
     * if false , you must use {@link com.alibaba.excel.annotation.ExcelProperty} to use a filed.
Z
zhuangjiaju 已提交
85
     *
Z
zhuangjiaju 已提交
86 87 88 89 90
     * @deprecated Just to be compatible with historical data, The default is always going to be convert all filed.
     */
    @Deprecated
    private Boolean convertAllFiled;

Z
zhuangjiaju 已提交
91 92 93 94 95 96
    /**
     * List is returned by default, now map is returned by default
     */
    @Deprecated
    private Boolean defaultReturnMap;

Z
zhuangjiaju 已提交
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
    public ExcelTypeEnum getExcelType() {
        return excelType;
    }

    public void setExcelType(ExcelTypeEnum excelType) {
        this.excelType = excelType;
    }

    public InputStream getInputStream() {
        return inputStream;
    }

    public void setInputStream(InputStream inputStream) {
        this.inputStream = inputStream;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public Boolean getAutoCloseStream() {
        return autoCloseStream;
    }

    public void setAutoCloseStream(Boolean autoCloseStream) {
        this.autoCloseStream = autoCloseStream;
    }

129 130 131 132 133 134 135 136
    public Object getCustomObject() {
        return customObject;
    }

    public void setCustomObject(Object customObject) {
        this.customObject = customObject;
    }

Z
zhuangjiaju 已提交
137 138 139 140 141 142 143 144
    public Boolean getMandatoryUseInputStream() {
        return mandatoryUseInputStream;
    }

    public void setMandatoryUseInputStream(Boolean mandatoryUseInputStream) {
        this.mandatoryUseInputStream = mandatoryUseInputStream;
    }

145 146 147 148 149 150 151 152
    public ReadCache getReadCache() {
        return readCache;
    }

    public void setReadCache(ReadCache readCache) {
        this.readCache = readCache;
    }

Z
zhuangjiaju 已提交
153 154 155 156 157 158 159
    public Boolean getConvertAllFiled() {
        return convertAllFiled;
    }

    public void setConvertAllFiled(Boolean convertAllFiled) {
        this.convertAllFiled = convertAllFiled;
    }
Z
zhuangjiaju 已提交
160 161 162 163 164 165 166 167

    public Boolean getDefaultReturnMap() {
        return defaultReturnMap;
    }

    public void setDefaultReturnMap(Boolean defaultReturnMap) {
        this.defaultReturnMap = defaultReturnMap;
    }
庄家钜's avatar
庄家钜 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183

    public Boolean getIgnoreEmptyRow() {
        return ignoreEmptyRow;
    }

    public void setIgnoreEmptyRow(Boolean ignoreEmptyRow) {
        this.ignoreEmptyRow = ignoreEmptyRow;
    }

    public ReadCacheSelector getReadCacheSelector() {
        return readCacheSelector;
    }

    public void setReadCacheSelector(ReadCacheSelector readCacheSelector) {
        this.readCacheSelector = readCacheSelector;
    }
庄家钜's avatar
庄家钜 已提交
184 185 186 187 188 189 190 191

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
庄家钜's avatar
庄家钜 已提交
192 193 194 195 196 197 198 199

    public String getXlsxSAXParserFactoryName() {
        return xlsxSAXParserFactoryName;
    }

    public void setXlsxSAXParserFactoryName(String xlsxSAXParserFactoryName) {
        this.xlsxSAXParserFactoryName = xlsxSAXParserFactoryName;
    }
Z
zhuangjiaju 已提交
200
}