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

cn.renlm.plugins.MyExcel.config.MyWorkbook Maven / Gradle / Ivy

There is a newer version: 2.8.8
Show newest version
/*
 * Copyright (c) 2020 Renlm
 * MyExcel is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 * 	http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package cn.renlm.plugins.MyExcel.config;

import java.io.Serializable;
import java.util.List;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

/**
 * 工作簿配置
 * 
 * @author RenLiMing(任黎明)
 *
 */
@Data
@XStreamAlias("excel")
public class MyWorkbook implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 表格名称
	 */
	@XStreamAsAttribute
	private String name;

	/**
	 * 引用模板
	 */
	@XStreamAsAttribute
	private String ref;

	/**
	 * Csv编码(处理Csv时使用)
	 */
	@XStreamAsAttribute
	@XStreamAlias("csv-charset")
	private String csvCharset;

	/**
	 * Sheet集
	 */
	@XStreamImplicit(itemFieldName = "sheet")
	private List sheets;

	/**
	 * 根据 sheetName 获取配置
	 * 
	 * @param sheetName
	 * @return
	 */
	public MySheet getSheetByName(String sheetName) {
		for (MySheet item : this.sheets) {
			if (StrUtil.equals(sheetName, item.getName())) {
				return item;
			}
		}
		return null;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy