我有一个名为ExportExcelCell的类,我将其分配给泛型类型
package com.morningstar.portfolioservice.domain.export;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.morningstar.portfolioservice.utils.export.ColumnDataType;
public class ExportExcelCell<T> {
@JsonProperty("text")
private T text;
@JsonProperty("style")
private String style;
@JsonProperty("cellRowSpan")
private Integer cellRowSpan;
@JsonProperty("cellColSpan")
private Integer cellColSpan;
@JsonProperty("cellAlignment")
private String cellAlignment;
private String cellVerticalAlignment;
@JsonProperty("cellFontName")
private String cellFontName;
@JsonProperty("cellFontSize")
private Short cellFontSize;
@JsonProperty("cellFontColor")
private Short cellFontColor;
@JsonProperty("cellType")
private ColumnDataType cellType;
@JsonProperty("cellNumericFormat")
private String cellNumericFormat;
@JsonProperty("cellDateFormat")
private String cellDateFormat;
public ExportExcelCell() {
}
public T getText() {
return text;
}
public void setText(Ttext) {
this.text = text;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
public Integer getCellRowSpan() {
return cellRowSpan;
}
public void setCellRowSpan(int cellRowSpan) {
this.cellRowSpan = cellRowSpan;
}
public Integer getCellColSpan() {
return cellColSpan;
}
public void setCellColSpan(int cellColSpan) {
this.cellColSpan = cellColSpan;
}
public String getCellAlignment() {
return cellAlignment;
}
@JsonProperty("cellVAlignment")
public String getCellVerticalAlignment() {
return cellVerticalAlignment;
}
public void setCellVerticalAlignment(String cellVerticalAlignment) {
this.cellVerticalAlignment = cellVerticalAlignment;
}
public void setCellAlignment(String exportExcelDefaultCellAlignment) {
this.cellAlignment = exportExcelDefaultCellAlignment;
}
public String getCellFontName() {
return cellFontName;
}
public void setCellFontName(String cellFontName) {
this.cellFontName = cellFontName;
}
public Short getCellFontSize() {
return cellFontSize;
}
public void setCellFontSize(Short cellFontSize) {
this.cellFontSize = cellFontSize;
}
public Short getCellFontColor() {
return cellFontColor;
}
public void setCellFontColor(Short cellFontColor) {
this.cellFontColor = cellFontColor;
}
public ColumnDataType getCellType() {
return cellType;
}
public void setCellType(ColumnDataType cellType) {
this.cellType = cellType;
}
public String getCellNumericFormat() {
return cellNumericFormat;
}
public void setCellNumericFormat(String cellNumericFormat) {
this.cellNumericFormat = cellNumericFormat;
}
public String getCellDateFormat() {
return cellDateFormat;
}
public void setCellDateFormat(String cellDateFormat) {
this.cellDateFormat = cellDateFormat;
}
@Override
public String toString() {
return "ExportExcelCell [text=" + text + ", style=" + style
+ ", cellRowSpan=" + cellRowSpan + ", cellColSpan="
+ cellColSpan + ", cellAlignment=" + cellAlignment
+ ", cellVerticalAlignment=" + cellVerticalAlignment
+ ", cellFontName=" + cellFontName + ", cellFontSize="
+ cellFontSize + ", cellFontColor=" + cellFontColor
+ ", cellType=" + cellType + ", cellNumericFormat="
+ cellNumericFormat + ", cellDateFormat=" + cellDateFormat
+ "]";
}
}
在ExportCellRow中调用类,在ExportExcellSegment中调用类ExportCellRow,在ExportExcelSheet中调用类ExportExcellSegment。
当我没有在ExportCellRow中将通用分配给ExportExcelCell时,我收到警告。
警告是 ExportExcelCell是原始类型。应该是对泛型类型ExportExcelCell的引用 参数
有没有办法只将通用类型分配给ExportExcelCell,或者可能在ExportCellRow中,而不必在上面提到的所有其他类中都这样做,因为我只需要ExportExcelCell中的泛型类型?