From 9d014aa00bfa12045fea7ea20bc2e31cadf2b36f Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Sun, 29 Nov 2015 02:43:17 +0000 Subject: [PATCH] bug 52903/58557: add @Override decorators to XSSFHyperlink and HSSFHyperlink git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717026 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/usermodel/HSSFHyperlink.java | 31 ++++++++++++++----- .../poi/xssf/usermodel/XSSFHyperlink.java | 13 ++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java b/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java index e8221264c..dbefaabe5 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java @@ -25,24 +25,28 @@ import org.apache.poi.ss.usermodel.Hyperlink; public class HSSFHyperlink implements Hyperlink { /** - * Link to an existing file or web page + * Link to an existing file or web page + * May be deprecated in the future. Consider using {@link Hyperlink#LINK_URL} instead. */ - public static final int LINK_URL = 1; + public static final int LINK_URL = Hyperlink.LINK_URL; /** * Link to a place in this document + * May be deprecated in the future. Consider using {@link Hyperlink#LINK_DOCUMENT} instead. */ - public static final int LINK_DOCUMENT = 2; + public static final int LINK_DOCUMENT = Hyperlink.LINK_DOCUMENT; /** * Link to an E-mail address + * May be deprecated in the future. Consider using {@link Hyperlink#LINK_EMAIL} instead. */ - public static final int LINK_EMAIL = 3; + public static final int LINK_EMAIL = Hyperlink.LINK_EMAIL; /** * Link to a file + * May be deprecated in the future. Consider using {@link Hyperlink#LINK_FILE} instead. */ - public static final int LINK_FILE = 4; + public static final int LINK_FILE = Hyperlink.LINK_FILE; /** * Low-level record object that stores the actual hyperlink data @@ -127,6 +131,7 @@ public class HSSFHyperlink implements Hyperlink { * * @return the 0-based row of the cell that contains the hyperlink */ + @Override public int getFirstRow(){ return record.getFirstRow(); } @@ -136,6 +141,7 @@ public class HSSFHyperlink implements Hyperlink { * * @param row the 0-based row of the first cell that contains the hyperlink */ + @Override public void setFirstRow(int row){ record.setFirstRow(row); } @@ -145,6 +151,7 @@ public class HSSFHyperlink implements Hyperlink { * * @return the 0-based row of the last cell that contains the hyperlink */ + @Override public int getLastRow(){ return record.getLastRow(); } @@ -154,6 +161,7 @@ public class HSSFHyperlink implements Hyperlink { * * @param row the 0-based row of the last cell that contains the hyperlink */ + @Override public void setLastRow(int row){ record.setLastRow(row); } @@ -163,6 +171,7 @@ public class HSSFHyperlink implements Hyperlink { * * @return the 0-based column of the first cell that contains the hyperlink */ + @Override public int getFirstColumn(){ return record.getFirstColumn(); } @@ -172,6 +181,7 @@ public class HSSFHyperlink implements Hyperlink { * * @param col the 0-based column of the first cell that contains the hyperlink */ + @Override public void setFirstColumn(int col){ record.setFirstColumn((short)col); } @@ -181,6 +191,7 @@ public class HSSFHyperlink implements Hyperlink { * * @return the 0-based column of the last cell that contains the hyperlink */ + @Override public int getLastColumn(){ return record.getLastColumn(); } @@ -190,6 +201,7 @@ public class HSSFHyperlink implements Hyperlink { * * @param col the 0-based column of the last cell that contains the hyperlink */ + @Override public void setLastColumn(int col){ record.setLastColumn((short)col); } @@ -198,7 +210,8 @@ public class HSSFHyperlink implements Hyperlink { * Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc. * * @return the address of this hyperlink - */ + */ + @Override public String getAddress(){ return record.getAddress(); } @@ -230,7 +243,8 @@ public class HSSFHyperlink implements Hyperlink { * Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc. * * @param address the address of this hyperlink - */ + */ + @Override public void setAddress(String address){ record.setAddress(address); } @@ -240,6 +254,7 @@ public class HSSFHyperlink implements Hyperlink { * * @return text to display */ + @Override public String getLabel(){ return record.getLabel(); } @@ -249,6 +264,7 @@ public class HSSFHyperlink implements Hyperlink { * * @param label text label for this hyperlink */ + @Override public void setLabel(String label){ record.setLabel(label); } @@ -258,6 +274,7 @@ public class HSSFHyperlink implements Hyperlink { * * @return the type of this hyperlink */ + @Override public int getType(){ return link_type; } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java index 2636c7ed0..4b70d50e2 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java @@ -151,6 +151,7 @@ public class XSSFHyperlink implements Hyperlink { * * @return the type of this hyperlink */ + @Override public int getType() { return _type; } @@ -168,6 +169,7 @@ public class XSSFHyperlink implements Hyperlink { * * @return the address of this hyperlink */ + @Override public String getAddress() { return _location; } @@ -177,6 +179,7 @@ public class XSSFHyperlink implements Hyperlink { * * @return text to display */ + @Override public String getLabel() { return _ctHyperlink.getDisplay(); } @@ -196,6 +199,7 @@ public class XSSFHyperlink implements Hyperlink { * * @param label text label for this hyperlink */ + @Override public void setLabel(String label) { _ctHyperlink.setDisplay(label); } @@ -215,6 +219,7 @@ public class XSSFHyperlink implements Hyperlink { * * @param address - the address of this hyperlink */ + @Override public void setAddress(String address) { validate(address); @@ -267,6 +272,7 @@ public class XSSFHyperlink implements Hyperlink { * * @return the 0-based column of the first cell that contains the hyperlink */ + @Override public int getFirstColumn() { return buildCellReference().getCol(); } @@ -277,6 +283,7 @@ public class XSSFHyperlink implements Hyperlink { * * @return the 0-based column of the last cell that contains the hyperlink */ + @Override public int getLastColumn() { return buildCellReference().getCol(); } @@ -286,6 +293,7 @@ public class XSSFHyperlink implements Hyperlink { * * @return the 0-based row of the cell that contains the hyperlink */ + @Override public int getFirstRow() { return buildCellReference().getRow(); } @@ -296,6 +304,7 @@ public class XSSFHyperlink implements Hyperlink { * * @return the 0-based row of the last cell that contains the hyperlink */ + @Override public int getLastRow() { return buildCellReference().getRow(); } @@ -305,6 +314,7 @@ public class XSSFHyperlink implements Hyperlink { * * @param col the 0-based column of the first cell that contains the hyperlink */ + @Override public void setFirstColumn(int col) { setCellReference(new CellReference( getFirstRow(), col )); } @@ -315,6 +325,7 @@ public class XSSFHyperlink implements Hyperlink { * * @param col the 0-based column of the last cell that contains the hyperlink */ + @Override public void setLastColumn(int col) { setFirstColumn(col); } @@ -324,6 +335,7 @@ public class XSSFHyperlink implements Hyperlink { * * @param row the 0-based row of the first cell that contains the hyperlink */ + @Override public void setFirstRow(int row) { setCellReference(new CellReference( row, getFirstColumn() )); } @@ -334,6 +346,7 @@ public class XSSFHyperlink implements Hyperlink { * * @param row the 0-based row of the last cell that contains the hyperlink */ + @Override public void setLastRow(int row) { setFirstRow(row); }