forked from fanruan/easyexcel
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
6 years ago
|
package com.alibaba.excel.converters;
|
||
|
|
||
|
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||
|
|
||
|
/**
|
||
|
* Converter unique key
|
||
|
*
|
||
|
* @author zhuangjiaju
|
||
|
*/
|
||
|
public class ConverterKey {
|
||
|
|
||
|
private Class javaTypeKey;
|
||
|
private CellDataTypeEnum excelTypeKey;
|
||
|
|
||
|
public ConverterKey(Class javaTypeKey, CellDataTypeEnum excelTypeKey) {
|
||
|
if (javaTypeKey == null || excelTypeKey == null) {
|
||
|
throw new IllegalArgumentException("All parameters can not be null");
|
||
|
}
|
||
|
this.javaTypeKey = javaTypeKey;
|
||
|
this.excelTypeKey = excelTypeKey;
|
||
|
}
|
||
|
|
||
|
public static ConverterKey buildConverterKey(Class javaTypeKey, CellDataTypeEnum excelTypeKey) {
|
||
|
return new ConverterKey(javaTypeKey, excelTypeKey);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean equals(Object o) {
|
||
|
if (this == o) {
|
||
|
return true;
|
||
|
}
|
||
|
if (o == null || getClass() != o.getClass()) {
|
||
|
return false;
|
||
|
}
|
||
|
ConverterKey that = (ConverterKey)o;
|
||
|
if (javaTypeKey != null ? !javaTypeKey.equals(that.javaTypeKey) : that.javaTypeKey != null) {
|
||
|
return false;
|
||
|
}
|
||
|
return excelTypeKey == that.excelTypeKey;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int hashCode() {
|
||
|
int result = javaTypeKey != null ? javaTypeKey.hashCode() : 0;
|
||
|
result = 31 * result + (excelTypeKey != null ? excelTypeKey.hashCode() : 0);
|
||
|
return result;
|
||
|
}
|
||
|
}
|