mirror of https://github.com/alibaba/easyexcel
Jiaju Zhuang
3 years ago
20 changed files with 501 additions and 353 deletions
@ -0,0 +1,63 @@
|
||||
package com.alibaba.excel.write.handler.chain; |
||||
|
||||
import com.alibaba.excel.write.handler.CellWriteHandler; |
||||
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* Execute the cell handler chain |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Data |
||||
public class CellHandlerExecutionChain { |
||||
/** |
||||
* next chain |
||||
*/ |
||||
private CellHandlerExecutionChain next; |
||||
/** |
||||
* handler |
||||
*/ |
||||
private CellWriteHandler handler; |
||||
|
||||
public CellHandlerExecutionChain(CellWriteHandler handler) { |
||||
this.handler = handler; |
||||
} |
||||
|
||||
public void beforeCellCreate(CellWriteHandlerContext context) { |
||||
this.handler.beforeCellCreate(context); |
||||
if (this.next != null) { |
||||
this.next.beforeCellCreate(context); |
||||
} |
||||
} |
||||
|
||||
public void afterCellCreate(CellWriteHandlerContext context) { |
||||
this.handler.afterCellCreate(context); |
||||
if (this.next != null) { |
||||
this.next.afterCellCreate(context); |
||||
} |
||||
} |
||||
|
||||
public void afterCellDataConverted(CellWriteHandlerContext context) { |
||||
this.handler.afterCellDataConverted(context); |
||||
if (this.next != null) { |
||||
this.next.afterCellDataConverted(context); |
||||
} |
||||
} |
||||
|
||||
public void afterCellDispose(CellWriteHandlerContext context) { |
||||
this.handler.afterCellDispose(context); |
||||
if (this.next != null) { |
||||
this.next.afterCellDispose(context); |
||||
} |
||||
} |
||||
|
||||
public void addLast(CellWriteHandler handler) { |
||||
CellHandlerExecutionChain context = this; |
||||
while (context.next != null) { |
||||
context = context.next; |
||||
} |
||||
context.next = new CellHandlerExecutionChain(handler); |
||||
} |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.alibaba.excel.write.handler.chain; |
||||
|
||||
import com.alibaba.excel.write.handler.RowWriteHandler; |
||||
import com.alibaba.excel.write.handler.context.RowWriteHandlerContext; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* Execute the row handler chain |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Data |
||||
public class RowHandlerExecutionChain { |
||||
/** |
||||
* next chain |
||||
*/ |
||||
private RowHandlerExecutionChain next; |
||||
/** |
||||
* handler |
||||
*/ |
||||
private RowWriteHandler handler; |
||||
|
||||
public RowHandlerExecutionChain(RowWriteHandler handler) { |
||||
this.handler = handler; |
||||
} |
||||
|
||||
public void beforeRowCreate(RowWriteHandlerContext context) { |
||||
this.handler.beforeRowCreate(context); |
||||
if (this.next != null) { |
||||
this.next.beforeRowCreate(context); |
||||
} |
||||
} |
||||
|
||||
public void afterRowCreate(RowWriteHandlerContext context) { |
||||
this.handler.afterRowCreate(context); |
||||
if (this.next != null) { |
||||
this.next.afterRowCreate(context); |
||||
} |
||||
} |
||||
|
||||
public void afterRowDispose(RowWriteHandlerContext context) { |
||||
this.handler.afterRowDispose(context); |
||||
if (this.next != null) { |
||||
this.next.afterRowDispose(context); |
||||
} |
||||
} |
||||
|
||||
public void addLast(RowWriteHandler handler) { |
||||
RowHandlerExecutionChain context = this; |
||||
while (context.next != null) { |
||||
context = context.next; |
||||
} |
||||
context.next = new RowHandlerExecutionChain(handler); |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.alibaba.excel.write.handler.chain; |
||||
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler; |
||||
import com.alibaba.excel.write.handler.context.SheetWriteHandlerContext; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* Execute the sheet handler chain |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Data |
||||
public class SheetHandlerExecutionChain { |
||||
/** |
||||
* next chain |
||||
*/ |
||||
private SheetHandlerExecutionChain next; |
||||
/** |
||||
* handler |
||||
*/ |
||||
private SheetWriteHandler handler; |
||||
|
||||
public SheetHandlerExecutionChain(SheetWriteHandler handler) { |
||||
this.handler = handler; |
||||
} |
||||
|
||||
public void beforeSheetCreate(SheetWriteHandlerContext context) { |
||||
this.handler.beforeSheetCreate(context); |
||||
if (this.next != null) { |
||||
this.next.beforeSheetCreate(context); |
||||
} |
||||
} |
||||
|
||||
public void afterSheetCreate(SheetWriteHandlerContext context) { |
||||
this.handler.afterSheetCreate(context); |
||||
if (this.next != null) { |
||||
this.next.afterSheetCreate(context); |
||||
} |
||||
} |
||||
public void addLast(SheetWriteHandler handler) { |
||||
SheetHandlerExecutionChain context = this; |
||||
while (context.next != null) { |
||||
context = context.next; |
||||
} |
||||
context.next = new SheetHandlerExecutionChain(handler); |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.alibaba.excel.write.handler.chain; |
||||
|
||||
import com.alibaba.excel.write.handler.WorkbookWriteHandler; |
||||
import com.alibaba.excel.write.handler.context.WorkbookWriteHandlerContext; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* Execute the workbook handler chain |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Data |
||||
public class WorkbookHandlerExecutionChain { |
||||
/** |
||||
* next chain |
||||
*/ |
||||
private WorkbookHandlerExecutionChain next; |
||||
|
||||
/** |
||||
* handler |
||||
*/ |
||||
private WorkbookWriteHandler handler; |
||||
|
||||
public WorkbookHandlerExecutionChain(WorkbookWriteHandler handler) { |
||||
this.handler = handler; |
||||
} |
||||
|
||||
public void beforeWorkbookCreate(WorkbookWriteHandlerContext context) { |
||||
this.handler.beforeWorkbookCreate(context); |
||||
if (this.next != null) { |
||||
this.next.beforeWorkbookCreate(context); |
||||
} |
||||
} |
||||
|
||||
public void afterWorkbookCreate(WorkbookWriteHandlerContext context) { |
||||
this.handler.afterWorkbookCreate(context); |
||||
if (this.next != null) { |
||||
this.next.afterWorkbookCreate(context); |
||||
} |
||||
} |
||||
|
||||
public void afterWorkbookDispose(WorkbookWriteHandlerContext context) { |
||||
this.handler.afterWorkbookDispose(context); |
||||
if (this.next != null) { |
||||
this.next.afterWorkbookDispose(context); |
||||
} |
||||
} |
||||
|
||||
public void addLast(WorkbookWriteHandler handler) { |
||||
WorkbookHandlerExecutionChain context = this; |
||||
while (context.next != null) { |
||||
context = context.next; |
||||
} |
||||
context.next = new WorkbookHandlerExecutionChain(handler); |
||||
} |
||||
} |
Loading…
Reference in new issue