Skip to content

Commit 52d4898

Browse files
refactor: add deprecated setters to property classes before making them immutable
1 parent 429db33 commit 52d4898

10 files changed

Lines changed: 460 additions & 76 deletions

File tree

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/ColumnWidthProperty.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@
3737
@Getter
3838
@AllArgsConstructor
3939
public class ColumnWidthProperty {
40-
private final Integer width;
40+
private Integer width;
41+
42+
/**
43+
* @deprecated This setter will be removed in a future release to make the class immutable.
44+
*/
45+
@Deprecated
46+
public void setWidth(Integer width) {
47+
this.width = width;
48+
}
4149

4250
public static ColumnWidthProperty build(ColumnWidth columnWidth) {
4351
if (columnWidth == null || columnWidth.value() < 0) {

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/DateTimeFormatProperty.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,24 @@
3838
@Getter
3939
@AllArgsConstructor
4040
public class DateTimeFormatProperty {
41-
private final String format;
42-
private final Boolean use1904windowing;
41+
private String format;
42+
private Boolean use1904windowing;
43+
44+
/**
45+
* @deprecated This setter will be removed in a future release to make the class immutable.
46+
*/
47+
@Deprecated
48+
public void setFormat(String format) {
49+
this.format = format;
50+
}
51+
52+
/**
53+
* @deprecated This setter will be removed in a future release to make the class immutable.
54+
*/
55+
@Deprecated
56+
public void setUse1904windowing(Boolean use1904windowing) {
57+
this.use1904windowing = use1904windowing;
58+
}
4359

4460
public static DateTimeFormatProperty build(DateTimeFormat dateTimeFormat) {
4561
if (dateTimeFormat == null) {

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/FontProperty.java

Lines changed: 90 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,32 +98,104 @@ public class FontProperty {
9898
*/
9999
private Boolean bold;
100100

101+
/**
102+
* @deprecated This setter will be removed in a future release to make the class immutable.
103+
*/
104+
@Deprecated
105+
public void setFontName(String fontName) {
106+
this.fontName = fontName;
107+
}
108+
109+
/**
110+
* @deprecated This setter will be removed in a future release to make the class immutable.
111+
*/
112+
@Deprecated
113+
public void setFontHeightInPoints(Short fontHeightInPoints) {
114+
this.fontHeightInPoints = fontHeightInPoints;
115+
}
116+
117+
/**
118+
* @deprecated This setter will be removed in a future release to make the class immutable.
119+
*/
120+
@Deprecated
121+
public void setItalic(Boolean italic) {
122+
this.italic = italic;
123+
}
124+
125+
/**
126+
* @deprecated This setter will be removed in a future release to make the class immutable.
127+
*/
128+
@Deprecated
129+
public void setStrikeout(Boolean strikeout) {
130+
this.strikeout = strikeout;
131+
}
132+
133+
/**
134+
* @deprecated This setter will be removed in a future release to make the class immutable.
135+
*/
136+
@Deprecated
137+
public void setColor(Short color) {
138+
this.color = color;
139+
}
140+
141+
/**
142+
* @deprecated This setter will be removed in a future release to make the class immutable.
143+
*/
144+
@Deprecated
145+
public void setTypeOffset(Short typeOffset) {
146+
this.typeOffset = typeOffset;
147+
}
148+
149+
/**
150+
* @deprecated This setter will be removed in a future release to make the class immutable.
151+
*/
152+
@Deprecated
153+
public void setUnderline(Byte underline) {
154+
this.underline = underline;
155+
}
156+
157+
/**
158+
* @deprecated This setter will be removed in a future release to make the class immutable.
159+
*/
160+
@Deprecated
161+
public void setCharset(Integer charset) {
162+
this.charset = charset;
163+
}
164+
165+
/**
166+
* @deprecated This setter will be removed in a future release to make the class immutable.
167+
*/
168+
@Deprecated
169+
public void setBold(Boolean bold) {
170+
this.bold = bold;
171+
}
172+
101173
public static FontProperty build(HeadFontStyle headFontStyle) {
102174
if (headFontStyle == null) {
103175
return null;
104176
}
105177
FontProperty styleProperty = new FontProperty();
106178
if (StringUtils.isNotBlank(headFontStyle.fontName())) {
107-
styleProperty.fontName = headFontStyle.fontName();
179+
styleProperty.setFontName(headFontStyle.fontName());
108180
}
109181
if (headFontStyle.fontHeightInPoints() >= 0) {
110-
styleProperty.fontHeightInPoints = headFontStyle.fontHeightInPoints();
182+
styleProperty.setFontHeightInPoints(headFontStyle.fontHeightInPoints());
111183
}
112-
styleProperty.italic = headFontStyle.italic().getBooleanValue();
113-
styleProperty.strikeout = headFontStyle.strikeout().getBooleanValue();
184+
styleProperty.setItalic(headFontStyle.italic().getBooleanValue());
185+
styleProperty.setStrikeout(headFontStyle.strikeout().getBooleanValue());
114186
if (headFontStyle.color() >= 0) {
115-
styleProperty.color = headFontStyle.color();
187+
styleProperty.setColor(headFontStyle.color());
116188
}
117189
if (headFontStyle.typeOffset() >= 0) {
118-
styleProperty.typeOffset = headFontStyle.typeOffset();
190+
styleProperty.setTypeOffset(headFontStyle.typeOffset());
119191
}
120192
if (headFontStyle.underline() >= 0) {
121-
styleProperty.underline = headFontStyle.underline();
193+
styleProperty.setUnderline(headFontStyle.underline());
122194
}
123195
if (headFontStyle.charset() >= 0) {
124-
styleProperty.charset = headFontStyle.charset();
196+
styleProperty.setCharset(headFontStyle.charset());
125197
}
126-
styleProperty.bold = headFontStyle.bold().getBooleanValue();
198+
styleProperty.setBold(headFontStyle.bold().getBooleanValue());
127199
return styleProperty;
128200
}
129201

@@ -133,26 +205,26 @@ public static FontProperty build(ContentFontStyle contentFontStyle) {
133205
}
134206
FontProperty styleProperty = new FontProperty();
135207
if (StringUtils.isNotBlank(contentFontStyle.fontName())) {
136-
styleProperty.fontName = contentFontStyle.fontName();
208+
styleProperty.setFontName(contentFontStyle.fontName());
137209
}
138210
if (contentFontStyle.fontHeightInPoints() >= 0) {
139-
styleProperty.fontHeightInPoints = contentFontStyle.fontHeightInPoints();
211+
styleProperty.setFontHeightInPoints(contentFontStyle.fontHeightInPoints());
140212
}
141-
styleProperty.italic = contentFontStyle.italic().getBooleanValue();
142-
styleProperty.strikeout = contentFontStyle.strikeout().getBooleanValue();
213+
styleProperty.setItalic(contentFontStyle.italic().getBooleanValue());
214+
styleProperty.setStrikeout(contentFontStyle.strikeout().getBooleanValue());
143215
if (contentFontStyle.color() >= 0) {
144-
styleProperty.color = contentFontStyle.color();
216+
styleProperty.setColor(contentFontStyle.color());
145217
}
146218
if (contentFontStyle.typeOffset() >= 0) {
147-
styleProperty.typeOffset = contentFontStyle.typeOffset();
219+
styleProperty.setTypeOffset(contentFontStyle.typeOffset());
148220
}
149221
if (contentFontStyle.underline() >= 0) {
150-
styleProperty.underline = contentFontStyle.underline();
222+
styleProperty.setUnderline(contentFontStyle.underline());
151223
}
152224
if (contentFontStyle.charset() >= 0) {
153-
styleProperty.charset = contentFontStyle.charset();
225+
styleProperty.setCharset(contentFontStyle.charset());
154226
}
155-
styleProperty.bold = contentFontStyle.bold().getBooleanValue();
227+
styleProperty.setBold(contentFontStyle.bold().getBooleanValue());
156228
return styleProperty;
157229
}
158230
}

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/LoopMergeProperty.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,27 @@ public class LoopMergeProperty {
4040
/**
4141
* Each row
4242
*/
43-
private final int eachRow;
43+
private int eachRow;
4444
/**
4545
* Extend column
4646
*/
47-
private final int columnExtend;
47+
private int columnExtend;
48+
49+
/**
50+
* @deprecated This setter will be removed in a future release to make the class immutable.
51+
*/
52+
@Deprecated
53+
public void setEachRow(int eachRow) {
54+
this.eachRow = eachRow;
55+
}
56+
57+
/**
58+
* @deprecated This setter will be removed in a future release to make the class immutable.
59+
*/
60+
@Deprecated
61+
public void setColumnExtend(int columnExtend) {
62+
this.columnExtend = columnExtend;
63+
}
4864

4965
public static LoopMergeProperty build(ContentLoopMerge contentLoopMerge) {
5066
if (contentLoopMerge == null) {

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/NumberFormatProperty.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,24 @@
3838
@Getter
3939
@AllArgsConstructor
4040
public class NumberFormatProperty {
41-
private final String format;
42-
private final RoundingMode roundingMode;
41+
private String format;
42+
private RoundingMode roundingMode;
43+
44+
/**
45+
* @deprecated This setter will be removed in a future release to make the class immutable.
46+
*/
47+
@Deprecated
48+
public void setFormat(String format) {
49+
this.format = format;
50+
}
51+
52+
/**
53+
* @deprecated This setter will be removed in a future release to make the class immutable.
54+
*/
55+
@Deprecated
56+
public void setRoundingMode(RoundingMode roundingMode) {
57+
this.roundingMode = roundingMode;
58+
}
4359

4460
public static NumberFormatProperty build(NumberFormat numberFormat) {
4561
if (numberFormat == null) {

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/OnceAbsoluteMergeProperty.java

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,51 @@ public class OnceAbsoluteMergeProperty {
4040
/**
4141
* First row
4242
*/
43-
private final int firstRowIndex;
43+
private int firstRowIndex;
4444
/**
4545
* Last row
4646
*/
47-
private final int lastRowIndex;
47+
private int lastRowIndex;
4848
/**
4949
* First column
5050
*/
51-
private final int firstColumnIndex;
51+
private int firstColumnIndex;
5252
/**
5353
* Last row
5454
*/
55-
private final int lastColumnIndex;
55+
private int lastColumnIndex;
56+
57+
/**
58+
* @deprecated This setter will be removed in a future release to make the class immutable.
59+
*/
60+
@Deprecated
61+
public void setFirstRowIndex(int firstRowIndex) {
62+
this.firstRowIndex = firstRowIndex;
63+
}
64+
65+
/**
66+
* @deprecated This setter will be removed in a future release to make the class immutable.
67+
*/
68+
@Deprecated
69+
public void setLastRowIndex(int lastRowIndex) {
70+
this.lastRowIndex = lastRowIndex;
71+
}
72+
73+
/**
74+
* @deprecated This setter will be removed in a future release to make the class immutable.
75+
*/
76+
@Deprecated
77+
public void setFirstColumnIndex(int firstColumnIndex) {
78+
this.firstColumnIndex = firstColumnIndex;
79+
}
80+
81+
/**
82+
* @deprecated This setter will be removed in a future release to make the class immutable.
83+
*/
84+
@Deprecated
85+
public void setLastColumnIndex(int lastColumnIndex) {
86+
this.lastColumnIndex = lastColumnIndex;
87+
}
5688

5789
public static OnceAbsoluteMergeProperty build(OnceAbsoluteMerge onceAbsoluteMerge) {
5890
if (onceAbsoluteMerge == null) {

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/RowHeightProperty.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@
3838
@Getter
3939
@AllArgsConstructor
4040
public class RowHeightProperty {
41-
private final Short height;
41+
private Short height;
42+
43+
/**
44+
* @deprecated This setter will be removed in a future release to make the class immutable.
45+
*/
46+
@Deprecated
47+
public void setHeight(Short height) {
48+
this.height = height;
49+
}
4250

4351
public static RowHeightProperty build(HeadRowHeight headRowHeight) {
4452
if (headRowHeight == null || headRowHeight.value() < 0) {

fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/property/SheetFreezePaneProperty.java

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,54 @@ public class SheetFreezePaneProperty {
3636
/**
3737
* Horizontal position of split.
3838
*/
39-
private final int colSplit;
39+
private int colSplit;
4040

4141
/**
4242
* Vertical position of split.
4343
*/
44-
private final int rowSplit;
44+
private int rowSplit;
4545

4646
/**
4747
* Left column visible in right pane.
4848
*/
49-
private final int leftmostColumn;
49+
private int leftmostColumn;
5050

5151
/**
5252
* Top row visible in bottom pane
5353
*/
54-
private final int topRow;
54+
private int topRow;
55+
56+
/**
57+
* @deprecated This setter will be removed in a future release to make the class immutable.
58+
*/
59+
@Deprecated
60+
public void setColSplit(int colSplit) {
61+
this.colSplit = colSplit;
62+
}
63+
64+
/**
65+
* @deprecated This setter will be removed in a future release to make the class immutable.
66+
*/
67+
@Deprecated
68+
public void setRowSplit(int rowSplit) {
69+
this.rowSplit = rowSplit;
70+
}
71+
72+
/**
73+
* @deprecated This setter will be removed in a future release to make the class immutable.
74+
*/
75+
@Deprecated
76+
public void setLeftmostColumn(int leftmostColumn) {
77+
this.leftmostColumn = leftmostColumn;
78+
}
79+
80+
/**
81+
* @deprecated This setter will be removed in a future release to make the class immutable.
82+
*/
83+
@Deprecated
84+
public void setTopRow(int topRow) {
85+
this.topRow = topRow;
86+
}
5587

5688
public static SheetFreezePaneProperty build(FreezePane freezePane) {
5789
if (freezePane == null) {

0 commit comments

Comments
 (0)