add @Override annotations to CreationHelper classes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753017 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4a8e7c393d
commit
f296b55b36
@ -19,30 +19,37 @@ package org.apache.poi.hssf.usermodel;
|
|||||||
|
|
||||||
import org.apache.poi.hssf.record.common.ExtendedColor;
|
import org.apache.poi.hssf.record.common.ExtendedColor;
|
||||||
import org.apache.poi.ss.usermodel.CreationHelper;
|
import org.apache.poi.ss.usermodel.CreationHelper;
|
||||||
|
import org.apache.poi.util.Internal;
|
||||||
|
|
||||||
public class HSSFCreationHelper implements CreationHelper {
|
public class HSSFCreationHelper implements CreationHelper {
|
||||||
private HSSFWorkbook workbook;
|
private final HSSFWorkbook workbook;
|
||||||
private HSSFDataFormat dataFormat;
|
|
||||||
|
|
||||||
HSSFCreationHelper(HSSFWorkbook wb) {
|
/**
|
||||||
|
* Should only be called by {@link HSSFWorkbook#getCreationHelper()}
|
||||||
|
*
|
||||||
|
* @param wb the workbook to create objects for
|
||||||
|
*/
|
||||||
|
@Internal(since="3.15 beta 3")
|
||||||
|
/*package*/ HSSFCreationHelper(HSSFWorkbook wb) {
|
||||||
workbook = wb;
|
workbook = wb;
|
||||||
|
|
||||||
// Create the things we only ever need one of
|
|
||||||
dataFormat = new HSSFDataFormat(workbook.getWorkbook());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HSSFRichTextString createRichTextString(String text) {
|
public HSSFRichTextString createRichTextString(String text) {
|
||||||
return new HSSFRichTextString(text);
|
return new HSSFRichTextString(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HSSFDataFormat createDataFormat() {
|
public HSSFDataFormat createDataFormat() {
|
||||||
return dataFormat;
|
return workbook.createDataFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HSSFHyperlink createHyperlink(int type) {
|
public HSSFHyperlink createHyperlink(int type) {
|
||||||
return new HSSFHyperlink(type);
|
return new HSSFHyperlink(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HSSFExtendedColor createExtendedColor() {
|
public HSSFExtendedColor createExtendedColor() {
|
||||||
return new HSSFExtendedColor(new ExtendedColor());
|
return new HSSFExtendedColor(new ExtendedColor());
|
||||||
}
|
}
|
||||||
@ -52,6 +59,7 @@ public class HSSFCreationHelper implements CreationHelper {
|
|||||||
*
|
*
|
||||||
* @return a HSSFFormulaEvaluator instance
|
* @return a HSSFFormulaEvaluator instance
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public HSSFFormulaEvaluator createFormulaEvaluator(){
|
public HSSFFormulaEvaluator createFormulaEvaluator(){
|
||||||
return new HSSFFormulaEvaluator(workbook);
|
return new HSSFFormulaEvaluator(workbook);
|
||||||
}
|
}
|
||||||
@ -62,6 +70,7 @@ public class HSSFCreationHelper implements CreationHelper {
|
|||||||
* @return a HSSFClientAnchor instance
|
* @return a HSSFClientAnchor instance
|
||||||
* @see org.apache.poi.ss.usermodel.Drawing
|
* @see org.apache.poi.ss.usermodel.Drawing
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public HSSFClientAnchor createClientAnchor(){
|
public HSSFClientAnchor createClientAnchor(){
|
||||||
return new HSSFClientAnchor();
|
return new HSSFClientAnchor();
|
||||||
}
|
}
|
||||||
|
@ -58,5 +58,11 @@ public interface CreationHelper {
|
|||||||
*/
|
*/
|
||||||
ExtendedColor createExtendedColor();
|
ExtendedColor createExtendedColor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ClientAnchor. Use this object to position drawing object in a sheet
|
||||||
|
*
|
||||||
|
* @return a ClientAnchor instance
|
||||||
|
* @see org.apache.poi.ss.usermodel.Drawing
|
||||||
|
*/
|
||||||
ClientAnchor createClientAnchor();
|
ClientAnchor createClientAnchor();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import org.apache.poi.ss.usermodel.CreationHelper;
|
|||||||
import org.apache.poi.ss.usermodel.DataFormat;
|
import org.apache.poi.ss.usermodel.DataFormat;
|
||||||
import org.apache.poi.ss.usermodel.ExtendedColor;
|
import org.apache.poi.ss.usermodel.ExtendedColor;
|
||||||
import org.apache.poi.ss.usermodel.Hyperlink;
|
import org.apache.poi.ss.usermodel.Hyperlink;
|
||||||
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFCreationHelper;
|
import org.apache.poi.xssf.usermodel.XSSFCreationHelper;
|
||||||
@ -33,35 +34,47 @@ import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
|||||||
* regular XSSF Workbook
|
* regular XSSF Workbook
|
||||||
*/
|
*/
|
||||||
public class SXSSFCreationHelper implements CreationHelper {
|
public class SXSSFCreationHelper implements CreationHelper {
|
||||||
private static POILogger logger = POILogFactory.getLogger(SXSSFCreationHelper.class);
|
private static final POILogger logger = POILogFactory.getLogger(SXSSFCreationHelper.class);
|
||||||
|
|
||||||
private SXSSFWorkbook wb;
|
private final SXSSFWorkbook wb;
|
||||||
private XSSFCreationHelper helper;
|
private final XSSFCreationHelper helper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should only be called by {@link SXSSFWorkbook#getCreationHelper()}
|
||||||
|
*
|
||||||
|
* @param workbook the workbook to create objects for
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
public SXSSFCreationHelper(SXSSFWorkbook workbook) {
|
public SXSSFCreationHelper(SXSSFWorkbook workbook) {
|
||||||
this.helper = new XSSFCreationHelper(workbook.getXSSFWorkbook());
|
this.helper = new XSSFCreationHelper(workbook.getXSSFWorkbook());
|
||||||
this.wb = workbook;
|
this.wb = workbook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public XSSFRichTextString createRichTextString(String text) {
|
public XSSFRichTextString createRichTextString(String text) {
|
||||||
logger.log(POILogger.INFO, "SXSSF doesn't support Rich Text Strings, any formatting information will be lost");
|
logger.log(POILogger.INFO, "SXSSF doesn't support Rich Text Strings, any formatting information will be lost");
|
||||||
return new XSSFRichTextString(text);
|
return new XSSFRichTextString(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SXSSFFormulaEvaluator createFormulaEvaluator() {
|
public SXSSFFormulaEvaluator createFormulaEvaluator() {
|
||||||
return new SXSSFFormulaEvaluator(wb);
|
return new SXSSFFormulaEvaluator(wb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass-through methods
|
// Pass-through methods
|
||||||
|
@Override
|
||||||
public DataFormat createDataFormat() {
|
public DataFormat createDataFormat() {
|
||||||
return helper.createDataFormat();
|
return helper.createDataFormat();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Hyperlink createHyperlink(int type) {
|
public Hyperlink createHyperlink(int type) {
|
||||||
return helper.createHyperlink(type);
|
return helper.createHyperlink(type);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ExtendedColor createExtendedColor() {
|
public ExtendedColor createExtendedColor() {
|
||||||
return helper.createExtendedColor();
|
return helper.createExtendedColor();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ClientAnchor createClientAnchor() {
|
public ClientAnchor createClientAnchor() {
|
||||||
return helper.createClientAnchor();
|
return helper.createClientAnchor();
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,13 @@ import org.apache.poi.ss.usermodel.Hyperlink;
|
|||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
|
|
||||||
public class XSSFCreationHelper implements CreationHelper {
|
public class XSSFCreationHelper implements CreationHelper {
|
||||||
private XSSFWorkbook workbook;
|
private final XSSFWorkbook workbook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should only be called by {@link XSSFWorkbook#getCreationHelper()}
|
||||||
|
*
|
||||||
|
* @param wb the workbook to create objects for
|
||||||
|
*/
|
||||||
@Internal
|
@Internal
|
||||||
public XSSFCreationHelper(XSSFWorkbook wb) {
|
public XSSFCreationHelper(XSSFWorkbook wb) {
|
||||||
workbook = wb;
|
workbook = wb;
|
||||||
@ -31,16 +36,19 @@ public class XSSFCreationHelper implements CreationHelper {
|
|||||||
/**
|
/**
|
||||||
* Creates a new XSSFRichTextString for you.
|
* Creates a new XSSFRichTextString for you.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public XSSFRichTextString createRichTextString(String text) {
|
public XSSFRichTextString createRichTextString(String text) {
|
||||||
XSSFRichTextString rt = new XSSFRichTextString(text);
|
XSSFRichTextString rt = new XSSFRichTextString(text);
|
||||||
rt.setStylesTableReference(workbook.getStylesSource());
|
rt.setStylesTableReference(workbook.getStylesSource());
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public XSSFDataFormat createDataFormat() {
|
public XSSFDataFormat createDataFormat() {
|
||||||
return workbook.createDataFormat();
|
return workbook.createDataFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public XSSFColor createExtendedColor() {
|
public XSSFColor createExtendedColor() {
|
||||||
return new XSSFColor();
|
return new XSSFColor();
|
||||||
}
|
}
|
||||||
@ -50,6 +58,7 @@ public class XSSFCreationHelper implements CreationHelper {
|
|||||||
*
|
*
|
||||||
* @param type - the type of hyperlink to create, see {@link Hyperlink}
|
* @param type - the type of hyperlink to create, see {@link Hyperlink}
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public XSSFHyperlink createHyperlink(int type) {
|
public XSSFHyperlink createHyperlink(int type) {
|
||||||
return new XSSFHyperlink(type);
|
return new XSSFHyperlink(type);
|
||||||
}
|
}
|
||||||
@ -59,6 +68,7 @@ public class XSSFCreationHelper implements CreationHelper {
|
|||||||
*
|
*
|
||||||
* @return a XSSFFormulaEvaluator instance
|
* @return a XSSFFormulaEvaluator instance
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public XSSFFormulaEvaluator createFormulaEvaluator() {
|
public XSSFFormulaEvaluator createFormulaEvaluator() {
|
||||||
return new XSSFFormulaEvaluator(workbook);
|
return new XSSFFormulaEvaluator(workbook);
|
||||||
}
|
}
|
||||||
@ -70,6 +80,7 @@ public class XSSFCreationHelper implements CreationHelper {
|
|||||||
* @return a XSSFClientAnchor instance
|
* @return a XSSFClientAnchor instance
|
||||||
* @see org.apache.poi.ss.usermodel.Drawing
|
* @see org.apache.poi.ss.usermodel.Drawing
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public XSSFClientAnchor createClientAnchor() {
|
public XSSFClientAnchor createClientAnchor() {
|
||||||
return new XSSFClientAnchor();
|
return new XSSFClientAnchor();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user