Skip to content

refactor: refactor code-style #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 21, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public class SharedStringsTableHandler extends DefaultHandler {

private static final Pattern UTF_PATTTERN = Pattern.compile("_x([0-9A-Fa-f]{4})_");
private static final Pattern UTF_PATTERN = Pattern.compile("_x([0-9A-Fa-f]{4})_");

/**
* The final piece of data
Expand Down Expand Up @@ -154,7 +154,7 @@ static String utfDecode(String value) {
}

StringBuilder buf = new StringBuilder();
Matcher m = UTF_PATTTERN.matcher(value);
Matcher m = UTF_PATTERN.matcher(value);
int idx = 0;
while (m.find()) {
int pos = m.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.Map;

import cn.idev.excel.util.MapUtils;

import lombok.Getter;
import org.apache.commons.io.ByteOrderMark;

Expand Down Expand Up @@ -35,9 +34,7 @@ public enum ByteOrderMarkEnum {
/**
* UTF_32LE
*/
UTF_32LE(ByteOrderMark.UTF_32LE),

;
UTF_32LE(ByteOrderMark.UTF_32LE);

final ByteOrderMark byteOrderMark;
final String stringPrefix;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.idev.excel.enums;

/**
* cache locaciton
* cache location
*
* @author Jiaju Zhuang
**/
Expand All @@ -19,5 +19,5 @@ public enum CacheLocationEnum {
/**
* No caching.It may lose some of performance.
*/
NONE;
NONE
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public enum CellDataTypeEnum {
/**
* rich text string.Support only when writing.
*/
RICH_TEXT_STRING,
;
RICH_TEXT_STRING;

private static final Map<String, CellDataTypeEnum> TYPE_ROUTING_MAP = new HashMap<String, CellDataTypeEnum>(16);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ public enum CellExtraTypeEnum {
/**
* Merge
*/
MERGE,;
MERGE
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ public enum HeadKindEnum {
/**
* String
*/
STRING;
STRING
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public enum ReadDefaultReturnEnum {
/**
* Return to {@link ReadCellData}, can decide which field you need.
*/
READ_CELL_DATA,
;
READ_CELL_DATA

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ public enum WriteLastRowTypeEnum {
/**
* Any data has been written;
*/
HAS_DATA,;
HAS_DATA
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ public enum WriteTemplateAnalysisCellTypeEnum {
/**
* A collection of fields.
*/
COLLECTION,;
COLLECTION
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ public enum WriteTypeEnum {
/**
* Fill.
*/
FILL,;
FILL
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private Object buildNoModel(Map<Integer, ReadCellData<?>> cellDataMap, ReadSheet
(String) ConverterUtils.convertToJavaObject(cellData, null, null, readSheetHolder.converterMap(),
context, context.readRowHolder().getRowIndex(), key));
} else {
// retrun ReadCellData
// return ReadCellData
ReadCellData<?> convertedReadCellData = convertReadCellData(cellData,
context.readWorkbookHolder().getReadDefaultReturn(), readSheetHolder, context, key);
if (readDefaultReturn == ReadDefaultReturnEnum.READ_CELL_DATA) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
import cn.idev.excel.cache.ReadCache;
import cn.idev.excel.cache.selector.ReadCacheSelector;
import cn.idev.excel.cache.selector.SimpleReadCacheSelector;
import cn.idev.excel.context.AnalysisContext;
import cn.idev.excel.enums.CellExtraTypeEnum;
import cn.idev.excel.enums.ReadDefaultReturnEnum;
import cn.idev.excel.event.AnalysisEventListener;
import cn.idev.excel.context.AnalysisContext;
import cn.idev.excel.read.listener.ModelBuildEventListener;
import cn.idev.excel.support.ExcelTypeEnum;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -97,7 +96,7 @@ public class ReadWorkbook extends ReadBasicParameter {
* Whether to use the default listener, which is used by default.
* <p>
* The {@link ModelBuildEventListener} is loaded by default to convert the object.
* defualt is true.
* default is true.
*/
private Boolean useDefaultListener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static short buildDataFormat(Workbook workbook, DataFormatData dataFormat
}
if (StringUtils.isNotBlank(dataFormatData.getFormat())) {
if (log.isDebugEnabled()) {
log.info("create new data fromat:{}", dataFormatData);
log.info("create new data format:{}", dataFormatData);
}
DataFormat dataFormatCreate = workbook.createDataFormat();
return dataFormatCreate.getFormat(dataFormatData.getFormat());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public void writeCellDataWrite() {
writeCellStyleData.setFillForegroundColor(IndexedColors.GREEN.getIndex());

// 设置单个单元格多种样式
// 这里需要设置 inMomery=true 不然会导致无法展示单个单元格多种样式,所以慎用
// 这里需要设置 inMemory=true 不然会导致无法展示单个单元格多种样式,所以慎用
WriteCellData<String> richTest = new WriteCellData<>();
richTest.setType(CellDataTypeEnum.RICH_TEXT_STRING);
writeCellDemoData.setRichText(richTest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CsvDataListeer extends AnalysisEventListener<CsvData> {
public class CsvDataListener extends AnalysisEventListener<CsvData> {
@Override
public void invoke(CsvData data, AnalysisContext context) {
log.info("data:{}", JSON.toJSONString(data));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void writev2() throws Exception {
// 如果这里想使用03 则 传入excelType参数即可
EasyExcel.write(fileName, CsvData.class).sheet().doWrite(data());

EasyExcel.read(fileName, CsvData.class, new CsvDataListeer()).sheet().doRead();
EasyExcel.read(fileName, CsvData.class, new CsvDataListener()).sheet().doRead();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
* and space ("_ ") in the format adds a space to the end and Excel formats this cell as <code>"12.34 "</code>, but
* <code>DataFormatter</code> trims the formatted value and returns <code>"12.34"</code>.
* </p>
* You can enable spaces by passing the <code>emulateCSV=true</code> flag in the <code>DateFormatter</code> cosntructor.
* You can enable spaces by passing the <code>emulateCSV=true</code> flag in the <code>DateFormatter</code> constructor.
* If set to true, then the output tries to conform to what you get when you take an xls or xlsx in Excel and Save As
* CSV file:
* <ul>
Expand Down
Loading