Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

package org.apache.fesod.sheet.metadata.property;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.sheet.annotation.write.style.ColumnWidth;

/**
Expand All @@ -35,13 +35,9 @@
*
*/
@Getter
@Setter
@AllArgsConstructor
public class ColumnWidthProperty {
private Integer width;

public ColumnWidthProperty(Integer width) {
this.width = width;
}
private final Integer width;

public static ColumnWidthProperty build(ColumnWidth columnWidth) {
if (columnWidth == null || columnWidth.value() < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@

package org.apache.fesod.sheet.metadata.property;

import lombok.EqualsAndHashCode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.common.util.BooleanUtils;
import org.apache.fesod.sheet.annotation.format.DateTimeFormat;

Expand All @@ -37,16 +36,10 @@
*
*/
@Getter
@Setter
@EqualsAndHashCode
@AllArgsConstructor
public class DateTimeFormatProperty {
private String format;
private Boolean use1904windowing;

public DateTimeFormatProperty(String format, Boolean use1904windowing) {
this.format = format;
this.use1904windowing = use1904windowing;
}
private final String format;
private final Boolean use1904windowing;

public static DateTimeFormatProperty build(DateTimeFormat dateTimeFormat) {
if (dateTimeFormat == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

package org.apache.fesod.sheet.metadata.property;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.common.util.StringUtils;
import org.apache.fesod.sheet.annotation.write.style.ContentFontStyle;
import org.apache.fesod.sheet.annotation.write.style.HeadFontStyle;
Expand All @@ -42,8 +40,6 @@
*
*/
@Getter
@Setter
@EqualsAndHashCode
public class FontProperty {
/**
* The name for the font (i.e. Arial)
Expand Down Expand Up @@ -108,26 +104,26 @@ public static FontProperty build(HeadFontStyle headFontStyle) {
}
FontProperty styleProperty = new FontProperty();
if (StringUtils.isNotBlank(headFontStyle.fontName())) {
styleProperty.setFontName(headFontStyle.fontName());
styleProperty.fontName = headFontStyle.fontName();
}
if (headFontStyle.fontHeightInPoints() >= 0) {
styleProperty.setFontHeightInPoints(headFontStyle.fontHeightInPoints());
styleProperty.fontHeightInPoints = headFontStyle.fontHeightInPoints();
}
styleProperty.setItalic(headFontStyle.italic().getBooleanValue());
styleProperty.setStrikeout(headFontStyle.strikeout().getBooleanValue());
styleProperty.italic = headFontStyle.italic().getBooleanValue();
styleProperty.strikeout = headFontStyle.strikeout().getBooleanValue();
if (headFontStyle.color() >= 0) {
styleProperty.setColor(headFontStyle.color());
styleProperty.color = headFontStyle.color();
}
if (headFontStyle.typeOffset() >= 0) {
styleProperty.setTypeOffset(headFontStyle.typeOffset());
styleProperty.typeOffset = headFontStyle.typeOffset();
}
if (headFontStyle.underline() >= 0) {
styleProperty.setUnderline(headFontStyle.underline());
styleProperty.underline = headFontStyle.underline();
}
if (headFontStyle.charset() >= 0) {
styleProperty.setCharset(headFontStyle.charset());
styleProperty.charset = headFontStyle.charset();
}
styleProperty.setBold(headFontStyle.bold().getBooleanValue());
styleProperty.bold = headFontStyle.bold().getBooleanValue();
return styleProperty;
}

Expand All @@ -137,26 +133,26 @@ public static FontProperty build(ContentFontStyle contentFontStyle) {
}
FontProperty styleProperty = new FontProperty();
if (StringUtils.isNotBlank(contentFontStyle.fontName())) {
styleProperty.setFontName(contentFontStyle.fontName());
styleProperty.fontName = contentFontStyle.fontName();
}
if (contentFontStyle.fontHeightInPoints() >= 0) {
styleProperty.setFontHeightInPoints(contentFontStyle.fontHeightInPoints());
styleProperty.fontHeightInPoints = contentFontStyle.fontHeightInPoints();
}
styleProperty.setItalic(contentFontStyle.italic().getBooleanValue());
styleProperty.setStrikeout(contentFontStyle.strikeout().getBooleanValue());
styleProperty.italic = contentFontStyle.italic().getBooleanValue();
styleProperty.strikeout = contentFontStyle.strikeout().getBooleanValue();
if (contentFontStyle.color() >= 0) {
styleProperty.setColor(contentFontStyle.color());
styleProperty.color = contentFontStyle.color();
}
if (contentFontStyle.typeOffset() >= 0) {
styleProperty.setTypeOffset(contentFontStyle.typeOffset());
styleProperty.typeOffset = contentFontStyle.typeOffset();
}
if (contentFontStyle.underline() >= 0) {
styleProperty.setUnderline(contentFontStyle.underline());
styleProperty.underline = contentFontStyle.underline();
}
if (contentFontStyle.charset() >= 0) {
styleProperty.setCharset(contentFontStyle.charset());
styleProperty.charset = contentFontStyle.charset();
}
styleProperty.setBold(contentFontStyle.bold().getBooleanValue());
styleProperty.bold = contentFontStyle.bold().getBooleanValue();
return styleProperty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

package org.apache.fesod.sheet.metadata.property;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.sheet.annotation.write.style.ContentLoopMerge;

/**
Expand All @@ -35,21 +35,16 @@
*
*/
@Getter
@Setter
@AllArgsConstructor
public class LoopMergeProperty {
/**
* Each row
*/
private int eachRow;
private final int eachRow;
/**
* Extend column
*/
private int columnExtend;

public LoopMergeProperty(int eachRow, int columnExtend) {
this.eachRow = eachRow;
this.columnExtend = columnExtend;
}
private final int columnExtend;

public static LoopMergeProperty build(ContentLoopMerge contentLoopMerge) {
if (contentLoopMerge == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
package org.apache.fesod.sheet.metadata.property;

import java.math.RoundingMode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.sheet.annotation.format.NumberFormat;

/**
Expand All @@ -36,15 +36,10 @@
*
*/
@Getter
@Setter
@AllArgsConstructor
public class NumberFormatProperty {
private String format;
private RoundingMode roundingMode;

public NumberFormatProperty(String format, RoundingMode roundingMode) {
this.format = format;
this.roundingMode = roundingMode;
}
private final String format;
private final RoundingMode roundingMode;

public static NumberFormatProperty build(NumberFormat numberFormat) {
if (numberFormat == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

package org.apache.fesod.sheet.metadata.property;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.sheet.annotation.write.style.OnceAbsoluteMerge;

/**
Expand All @@ -35,31 +35,24 @@
*
*/
@Getter
@Setter
@AllArgsConstructor
public class OnceAbsoluteMergeProperty {
/**
* First row
*/
private int firstRowIndex;
private final int firstRowIndex;
/**
* Last row
*/
private int lastRowIndex;
private final int lastRowIndex;
/**
* First column
*/
private int firstColumnIndex;
private final int firstColumnIndex;
/**
* Last row
*/
private int lastColumnIndex;

public OnceAbsoluteMergeProperty(int firstRowIndex, int lastRowIndex, int firstColumnIndex, int lastColumnIndex) {
this.firstRowIndex = firstRowIndex;
this.lastRowIndex = lastRowIndex;
this.firstColumnIndex = firstColumnIndex;
this.lastColumnIndex = lastColumnIndex;
}
private final int lastColumnIndex;

public static OnceAbsoluteMergeProperty build(OnceAbsoluteMerge onceAbsoluteMerge) {
if (onceAbsoluteMerge == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

package org.apache.fesod.sheet.metadata.property;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.sheet.annotation.write.style.ContentRowHeight;
import org.apache.fesod.sheet.annotation.write.style.HeadRowHeight;

Expand All @@ -36,13 +36,9 @@
*
*/
@Getter
@Setter
@AllArgsConstructor
public class RowHeightProperty {
private Short height;

public RowHeightProperty(Short height) {
this.height = height;
}
private final Short height;

public static RowHeightProperty build(HeadRowHeight headRowHeight) {
if (headRowHeight == null || headRowHeight.value() < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@

package org.apache.fesod.sheet.metadata.property;

import lombok.EqualsAndHashCode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.fesod.sheet.annotation.write.style.FreezePane;

/**
Expand All @@ -31,40 +30,38 @@
* It is typically built from the {@link FreezePane} annotation.
*/
@Getter
@Setter
@EqualsAndHashCode
@AllArgsConstructor
public class SheetFreezePaneProperty {

/**
* Horizontal position of split.
*/
private int colSplit;
private final int colSplit;

/**
* Vertical position of split.
*/
private int rowSplit;
private final int rowSplit;

/**
* Left column visible in right pane.
*/
private int leftmostColumn;
private final int leftmostColumn;

/**
* Top row visible in bottom pane
*/
private int topRow;
private final int topRow;

public static SheetFreezePaneProperty build(FreezePane freezePane) {
if (freezePane == null) {
return null;
}
SheetFreezePaneProperty result = new SheetFreezePaneProperty();
result.setColSplit(freezePane.colSplit());
result.setRowSplit(freezePane.rowSplit());
result.setLeftmostColumn(getOrDefault(freezePane.leftmostColumn(), freezePane.colSplit()));
result.setTopRow(getOrDefault(freezePane.topRow(), freezePane.rowSplit()));
return result;
return new SheetFreezePaneProperty(
freezePane.colSplit(),
freezePane.rowSplit(),
getOrDefault(freezePane.leftmostColumn(), freezePane.colSplit()),
getOrDefault(freezePane.topRow(), freezePane.rowSplit()));
}

private static Integer getOrDefault(Integer value, Integer defaultValue) {
Expand Down
Loading
Loading