aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2016-07-17 07:14:49 +0000
committerJaven O'Neal <onealj@apache.org>2016-07-17 07:14:49 +0000
commit0de74b143e9795011a153d6a99dc4fbcf0a6b16c (patch)
tree60283df53c990e976f9bc8595d063825ad4566b3
parentc0ee980ac79305f59e6a60847379805781116b1a (diff)
downloadpoi-0de74b143e9795011a153d6a99dc4fbcf0a6b16c.tar.gz
poi-0de74b143e9795011a153d6a99dc4fbcf0a6b16c.zip
add @Override annotations to CreationHelper classes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753017 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java23
-rw-r--r--src/java/org/apache/poi/ss/usermodel/CreationHelper.java6
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java19
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java13
4 files changed, 50 insertions, 11 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java
index 89f496fcf4..337255fd3b 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java
@@ -19,30 +19,37 @@ package org.apache.poi.hssf.usermodel;
import org.apache.poi.hssf.record.common.ExtendedColor;
import org.apache.poi.ss.usermodel.CreationHelper;
+import org.apache.poi.util.Internal;
public class HSSFCreationHelper implements CreationHelper {
- private HSSFWorkbook workbook;
- private HSSFDataFormat dataFormat;
+ private final HSSFWorkbook workbook;
- 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;
-
- // Create the things we only ever need one of
- dataFormat = new HSSFDataFormat(workbook.getWorkbook());
}
+ @Override
public HSSFRichTextString createRichTextString(String text) {
return new HSSFRichTextString(text);
}
+ @Override
public HSSFDataFormat createDataFormat() {
- return dataFormat;
+ return workbook.createDataFormat();
}
+ @Override
public HSSFHyperlink createHyperlink(int type) {
return new HSSFHyperlink(type);
}
+ @Override
public HSSFExtendedColor createExtendedColor() {
return new HSSFExtendedColor(new ExtendedColor());
}
@@ -52,6 +59,7 @@ public class HSSFCreationHelper implements CreationHelper {
*
* @return a HSSFFormulaEvaluator instance
*/
+ @Override
public HSSFFormulaEvaluator createFormulaEvaluator(){
return new HSSFFormulaEvaluator(workbook);
}
@@ -62,6 +70,7 @@ public class HSSFCreationHelper implements CreationHelper {
* @return a HSSFClientAnchor instance
* @see org.apache.poi.ss.usermodel.Drawing
*/
+ @Override
public HSSFClientAnchor createClientAnchor(){
return new HSSFClientAnchor();
}
diff --git a/src/java/org/apache/poi/ss/usermodel/CreationHelper.java b/src/java/org/apache/poi/ss/usermodel/CreationHelper.java
index 893ce41ec2..749cacf0b7 100644
--- a/src/java/org/apache/poi/ss/usermodel/CreationHelper.java
+++ b/src/java/org/apache/poi/ss/usermodel/CreationHelper.java
@@ -58,5 +58,11 @@ public interface CreationHelper {
*/
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();
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java
index 128803bfe0..24d6866657 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java
@@ -22,6 +22,7 @@ import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.ExtendedColor;
import org.apache.poi.ss.usermodel.Hyperlink;
+import org.apache.poi.util.Internal;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.xssf.usermodel.XSSFCreationHelper;
@@ -33,35 +34,47 @@ import org.apache.poi.xssf.usermodel.XSSFRichTextString;
* regular XSSF Workbook
*/
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 XSSFCreationHelper helper;
+ private final SXSSFWorkbook wb;
+ 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) {
this.helper = new XSSFCreationHelper(workbook.getXSSFWorkbook());
this.wb = workbook;
}
+ @Override
public XSSFRichTextString createRichTextString(String text) {
logger.log(POILogger.INFO, "SXSSF doesn't support Rich Text Strings, any formatting information will be lost");
return new XSSFRichTextString(text);
}
+ @Override
public SXSSFFormulaEvaluator createFormulaEvaluator() {
return new SXSSFFormulaEvaluator(wb);
}
// Pass-through methods
+ @Override
public DataFormat createDataFormat() {
return helper.createDataFormat();
}
+ @Override
public Hyperlink createHyperlink(int type) {
return helper.createHyperlink(type);
}
+ @Override
public ExtendedColor createExtendedColor() {
return helper.createExtendedColor();
}
+ @Override
public ClientAnchor createClientAnchor() {
return helper.createClientAnchor();
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java
index 2e5ca2d958..4ea560d33a 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java
@@ -21,8 +21,13 @@ import org.apache.poi.ss.usermodel.Hyperlink;
import org.apache.poi.util.Internal;
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
public XSSFCreationHelper(XSSFWorkbook wb) {
workbook = wb;
@@ -31,16 +36,19 @@ public class XSSFCreationHelper implements CreationHelper {
/**
* Creates a new XSSFRichTextString for you.
*/
+ @Override
public XSSFRichTextString createRichTextString(String text) {
XSSFRichTextString rt = new XSSFRichTextString(text);
rt.setStylesTableReference(workbook.getStylesSource());
return rt;
}
+ @Override
public XSSFDataFormat createDataFormat() {
return workbook.createDataFormat();
}
+ @Override
public XSSFColor createExtendedColor() {
return new XSSFColor();
}
@@ -50,6 +58,7 @@ public class XSSFCreationHelper implements CreationHelper {
*
* @param type - the type of hyperlink to create, see {@link Hyperlink}
*/
+ @Override
public XSSFHyperlink createHyperlink(int type) {
return new XSSFHyperlink(type);
}
@@ -59,6 +68,7 @@ public class XSSFCreationHelper implements CreationHelper {
*
* @return a XSSFFormulaEvaluator instance
*/
+ @Override
public XSSFFormulaEvaluator createFormulaEvaluator() {
return new XSSFFormulaEvaluator(workbook);
}
@@ -70,6 +80,7 @@ public class XSSFCreationHelper implements CreationHelper {
* @return a XSSFClientAnchor instance
* @see org.apache.poi.ss.usermodel.Drawing
*/
+ @Override
public XSSFClientAnchor createClientAnchor() {
return new XSSFClientAnchor();
}