From: Andreas Beeker Date: Thu, 15 Apr 2021 22:28:11 +0000 (+0000) Subject: fix javadocs X-Git-Tag: REL_5_1_0~246 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7ab1c9c0fd200a5b4d548131577e572b611c9206;p=poi.git fix javadocs git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888805 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFSheet.java index edd1d04497..5687ef90de 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFSheet.java @@ -25,7 +25,7 @@ import org.apache.poi.util.Beta; import org.apache.poi.xssf.usermodel.XSSFSheet; /** - * A variant of SXSSFSheet that uses a RowGeneratorFunction to lazily create rows. + * A variant of SXSSFSheet that uses a {@code RowGeneratorFunction} to lazily create rows. * * This variant is experimental and APIs may change at short notice. * @@ -36,20 +36,20 @@ import org.apache.poi.xssf.usermodel.XSSFSheet; @Beta public class DeferredSXSSFSheet extends SXSSFSheet { private RowGeneratorFunction rowGenerator; - + public DeferredSXSSFSheet(DeferredSXSSFWorkbook workbook, XSSFSheet xSheet) throws IOException { super(workbook, xSheet, workbook.getRandomAccessWindowSize()); } - + @Override public InputStream getWorksheetXMLInputStream() throws IOException { throw new RuntimeException("Not supported by DeferredSXSSFSheet"); } - + public void setRowGenerator(RowGeneratorFunction rowGenerator) { this.rowGenerator = rowGenerator; } - + public void writeRows(OutputStream out) throws IOException { // delayed creation of SheetDataWriter _writer = ((DeferredSXSSFWorkbook) _workbook).createSheetDataWriter(out); diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFName.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFName.java index aa76fba89d..1e9047009e 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFName.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFName.java @@ -30,10 +30,10 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedName; * Represents a defined named range in a SpreadsheetML workbook. *

* Defined names are descriptive text that is used to represents a cell, range of cells, formula, or constant value. - * Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as Sales!C20:C30. + * Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as {@code Sales!C20:C30}. *

* Example: - *
+ *
{@code
  *   XSSFWorkbook wb = new XSSFWorkbook();
  *   XSSFSheet sh = wb.createSheet("Sheet1");
  *
@@ -49,7 +49,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedName;
  *   name2.setLocalSheetId(0);
  *   name2.setRefersToFormula("Sheet1!$B$3");
  *
- * 
+ * } */ public final class XSSFName implements Name { @@ -79,11 +79,13 @@ public final class XSSFName implements Name { public static final String BUILTIN_EXTRACT = "_xlnm.Extract:"; /** - * ?an be one of the following + * Can be one of the following + * */ public static final String BUILTIN_FILTER_DB = "_xlnm._FilterDatabase"; @@ -102,8 +104,8 @@ public final class XSSFName implements Name { */ public static final String BUILTIN_SHEET_TITLE = "_xlnm.Sheet_Title"; - private XSSFWorkbook _workbook; - private CTDefinedName _ctName; + private final XSSFWorkbook _workbook; + private final CTDefinedName _ctName; /** * Creates an XSSFName object - called internally by XSSFWorkbook. @@ -129,6 +131,7 @@ public final class XSSFName implements Name { * * @return text name of this defined name */ + @Override public String getNameName() { return _ctName.getName(); } @@ -140,7 +143,7 @@ public final class XSSFName implements Name { *

* A name must always be unique within its scope. POI prevents you from defining a name that is not unique * within its scope. However you can use the same name in different scopes. Example: - *

+ *
{@code
      * //by default names are workbook-global
      * XSSFName name;
      * name = workbook.createName();
@@ -158,11 +161,12 @@ public final class XSSFName implements Name {
      * name.setSheetIndex(0);
      * name.setNameName("sales_08");  //will throw an exception: "The sheet already contains this name (case-insensitive)"
      *
-     * 
- *

+ * } + * * @param name name of this defined name * @throws IllegalArgumentException if the name is invalid or the workbook already contains this name (case-insensitive) */ + @Override public void setNameName(String name) { validateName(name); @@ -180,6 +184,7 @@ public final class XSSFName implements Name { _workbook.updateName(this, oldName); } + @Override public String getRefersToFormula() { String result = _ctName.getStringValue(); if (result == null || result.length() < 1) { @@ -188,6 +193,7 @@ public final class XSSFName implements Name { return result; } + @Override public void setRefersToFormula(String formulaText) { XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(_workbook); //validate through the FormulaParser @@ -196,6 +202,7 @@ public final class XSSFName implements Name { _ctName.setStringValue(formulaText); } + @Override public boolean isDeleted(){ String formulaText = getRefersToFormula(); if (formulaText == null) { @@ -211,6 +218,7 @@ public final class XSSFName implements Name { * * @param index the sheet index this name applies to, -1 unsets this property making the name workbook-global */ + @Override public void setSheetIndex(int index) { int lastSheetIx = _workbook.getNumberOfSheets() - 1; if (index < -1 || index > lastSheetIx) { @@ -230,6 +238,7 @@ public final class XSSFName implements Name { * * @return the sheet index this name applies to, -1 if this name applies to the entire workbook */ + @Override public int getSheetIndex() { return _ctName.isSetLocalSheetId() ? (int) _ctName.getLocalSheetId() : -1; } @@ -238,8 +247,9 @@ public final class XSSFName implements Name { * Indicates that the defined name refers to a user-defined function. * This attribute is used when there is an add-in or other code project associated with the file. * - * @param value true indicates the name refers to a function. + * @param value {@code true} indicates the name refers to a function. */ + @Override public void setFunction(boolean value) { _ctName.setFunction(value); } @@ -248,7 +258,7 @@ public final class XSSFName implements Name { * Indicates that the defined name refers to a user-defined function. * This attribute is used when there is an add-in or other code project associated with the file. * - * @return true indicates the name refers to a function. + * @return {@code true} indicates the name refers to a function. */ public boolean getFunction() { return _ctName.getFunction(); @@ -282,6 +292,7 @@ public final class XSSFName implements Name { * @return sheet name, which this named range referred to. * Empty string if the referenced sheet name was not found. */ + @Override public String getSheetName() { if (_ctName.isSetLocalSheetId()) { // Given as explicit sheet id @@ -296,8 +307,9 @@ public final class XSSFName implements Name { /** * Is the name refers to a user-defined function ? * - * @return true if this name refers to a user-defined function + * @return {@code true} if this name refers to a user-defined function */ + @Override public boolean isFunctionName() { return getFunction(); } @@ -308,6 +320,7 @@ public final class XSSFName implements Name { * * @return true if this name is a hidden one */ + @Override public boolean isHidden() { return _ctName.getHidden(); } @@ -317,6 +330,7 @@ public final class XSSFName implements Name { * * @return the user comment for this named range */ + @Override public String getComment() { return _ctName.getComment(); } @@ -326,6 +340,7 @@ public final class XSSFName implements Name { * * @param comment the user comment for this named range */ + @Override public void setComment(String comment) { _ctName.setComment(comment); } @@ -337,12 +352,12 @@ public final class XSSFName implements Name { /** * Compares this name to the specified object. - * The result is true if the argument is XSSFName and the + * The result is {@code true} if the argument is XSSFName and the * underlying CTDefinedName bean equals to the CTDefinedName representing this name * - * @param o the object to compare this XSSFName against. - * @return true if the XSSFName are equal; - * false otherwise. + * @param o the object to compare this {@code XSSFName} against. + * @return {@code true} if the {@code XSSFName }are equal; + * {@code false} otherwise. */ @Override public boolean equals(Object o) { @@ -372,8 +387,6 @@ public final class XSSFName implements Name { * Case sensitivity: all names are case-insensitive * * Uniqueness: must be unique (for names with the same scope) - * - * @param name */ private static void validateName(String name) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java index cfda49b0b0..0484773ecc 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java @@ -102,12 +102,12 @@ public class XSSFRow implements Row, Comparable { /** * Cell iterator over the physically defined cells: - *
+     * 
{@code
      * for (Iterator it = row.cellIterator(); it.hasNext(); ) {
      *     Cell cell = it.next();
      *     ...
      * }
-     * 
+ * } * * @return an iterator over cells in this row. */ @@ -133,22 +133,22 @@ public class XSSFRow implements Row, Comparable { } /** - * Compares two XSSFRow objects. Two rows are equal if they belong to the same worksheet and + * Compares two {@code XSSFRow} objects. Two rows are equal if they belong to the same worksheet and * their row indexes are equal. * - * @param other the XSSFRow to be compared. + * @param other the {@code XSSFRow} to be compared. * @return
    *
  • - * the value 0 if the row number of this XSSFRow is - * equal to the row number of the argument XSSFRow + * the value {@code 0} if the row number of this {@code XSSFRow} is + * equal to the row number of the argument {@code XSSFRow} *
  • *
  • - * a value less than 0 if the row number of this this XSSFRow is - * numerically less than the row number of the argument XSSFRow + * a value less than {@code 0} if the row number of this this {@code XSSFRow} is + * numerically less than the row number of the argument {@code XSSFRow} *
  • *
  • - * a value greater than 0 if the row number of this this XSSFRow is - * numerically greater than the row number of the argument XSSFRow + * a value greater than {@code 0} if the row number of this this {@code XSSFRow} is + * numerically greater than the row number of the argument {@code XSSFRow} *
  • *
* @throws IllegalArgumentException if the argument row belongs to a different worksheet @@ -186,7 +186,7 @@ public class XSSFRow implements Row, Comparable { * Use this to create new cells within the row and return it. *

* The cell that is returned is a {@link CellType#BLANK}. The type can be changed - * either through calling setCellValue or setCellType. + * either through calling {@code setCellValue} or {@code setCellType}. *

* @param columnIndex - the column number this cell represents * @return Cell a high level representation of the created cell. @@ -359,7 +359,7 @@ public class XSSFRow implements Row, Comparable { /** * Set the height in "twips" or 1/20th of a point. * - * @param height the height in "twips" or 1/20th of a point. -1 resets to the default height + * @param height the height in "twips" or 1/20th of a point. {@code -1} resets to the default height */ @Override public void setHeight(short height) { @@ -380,7 +380,7 @@ public class XSSFRow implements Row, Comparable { /** * Set the row's height in points. * - * @param height the height in points. -1 resets to the default height + * @param height the height in points. {@code -1} resets to the default height */ @Override public void setHeightInPoints(float height) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index cf910a7cd8..45216a8cdd 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -813,22 +813,19 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su /** * Create a new sheet for this Workbook and return the high level representation. * Use this to create new sheets. - * *

- * Note that Excel allows sheet names up to 31 chars in length but other applications - * (such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars, - * others - truncate such names to 31 character. - *

+ * Note that Excel allows sheet names up to 31 chars in length but other applications + * (such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars, + * others - truncate such names to 31 character. *

- * POI's SpreadsheetAPI silently truncates the input argument to 31 characters. - * Example: - * - *

{@code
-     *     Sheet sheet = workbook.createSheet("My very long sheet name which is longer than 31 chars"); // will be truncated
-     *     assert 31 == sheet.getSheetName().length();
-     *     assert "My very long sheet name which i" == sheet.getSheetName();
-     *     }
- *

+ * POI's SpreadsheetAPI silently truncates the input argument to 31 characters. + * Example: + * + *
{@code
+     * Sheet sheet = workbook.createSheet("My very long sheet name which is longer than 31 chars"); // will be truncated
+     * assert 31 == sheet.getSheetName().length();
+     * assert "My very long sheet name which i" == sheet.getSheetName();
+     * }
* * Except the 31-character constraint, Excel applies some other rules: *

@@ -845,12 +842,10 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su *

  • closing square bracket (])
  • * * The string MUST NOT begin or end with the single quote (') character. - *

    - * *

    * See {@link WorkbookUtil#createSafeSheetName(String nameProposal)} * for a safe way to create valid names - *

    + * * @param sheetname sheetname to set for the sheet. * @return Sheet representing the new sheet. * @throws IllegalArgumentException if the name is null or invalid diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakClear.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakClear.java index 33ece8f2e7..332e9c2d82 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakClear.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/BreakClear.java @@ -50,9 +50,9 @@ public enum BreakClear { * *
  • If this line is not broken into multiple regions, then treat this * break as a text wrapping break of type none.
  • - * *
  • If the parent paragraph is right to left, then these behaviors are * also reversed.
  • + * */ LEFT(2), @@ -81,7 +81,7 @@ public enum BreakClear { */ ALL(4); - private static Map imap = new HashMap<>(); + private static final Map imap = new HashMap<>(); static { for (BreakClear p : values()) { @@ -91,7 +91,7 @@ public enum BreakClear { private final int value; - private BreakClear(int val) { + BreakClear(int val) { value = val; } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java index 1df57f6d56..1ac9a05d98 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java @@ -90,7 +90,6 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes { /** * Remove the specified footnote if present. * - * @param pos * @return True if the footnote was removed. * @since 4.0.0 */ @@ -134,9 +133,6 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes { /** * add an {@link XWPFEndnote} to the document - * - * @param endnote - * @throws IOException */ public void addEndnote(XWPFEndnote endnote) { listFootnote.add(endnote); @@ -148,7 +144,6 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes { * * @param note Note to add * @return New {@link XWPFEndnote} - * @throws IOException */ @Internal public XWPFEndnote addEndnote(CTFtnEdn note) { @@ -164,6 +159,7 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes { * @param id End note ID. * @return The end note or null if not found. */ + @Override public XWPFEndnote getFootnoteById(int id) { return (XWPFEndnote)super.getFootnoteById(id); } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java index 8f7c591c5a..278e16da1a 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java @@ -136,7 +136,6 @@ public class XWPFFootnotes extends XWPFAbstractFootnotesEndnotes { * Add an {@link XWPFFootnote} to the document * * @param footnote Footnote to add - * @throws IOException */ public void addFootnote(XWPFFootnote footnote) { listFootnote.add(footnote); @@ -147,7 +146,6 @@ public class XWPFFootnotes extends XWPFAbstractFootnotesEndnotes { * Add a CT footnote to the document * * @param note CTFtnEdn to add. - * @throws IOException */ @Internal public XWPFFootnote addFootnote(CTFtnEdn note) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java index 4f09eb64de..ac3b8200e0 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java @@ -93,6 +93,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo return headerFooter; } + @Override public List getBodyElements() { return Collections.unmodifiableList(bodyElements); } @@ -104,6 +105,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo * there could be more in certain cases, or * a table. */ + @Override public List getParagraphs() { return Collections.unmodifiableList(paragraphs); } @@ -117,6 +119,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo * complex headers/footers have a table or two * in addition. */ + @Override public List getTables() throws ArrayIndexOutOfBoundsException { return Collections.unmodifiableList(tables); } @@ -129,9 +132,9 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo public String getText() { StringBuilder t = new StringBuilder(64); //TODO: simplify this to get ibody elements in order - for (int i = 0; i < paragraphs.size(); i++) { - if (!paragraphs.get(i).isEmpty()) { - String text = paragraphs.get(i).getText(); + for (XWPFParagraph paragraph : paragraphs) { + if (!paragraph.isEmpty()) { + String text = paragraph.getText(); if (text != null && text.length() > 0) { t.append(text); t.append('\n'); @@ -139,8 +142,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo } } - for (int i = 0; i < tables.size(); i++) { - String text = tables.get(i).getText(); + for (XWPFTable table : tables) { + String text = table.getText(); if (text != null && text.length() > 0) { t.append(text); t.append('\n'); @@ -149,7 +152,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo for (IBodyElement bodyElement : getBodyElements()) { if (bodyElement instanceof XWPFSDT) { - t.append(((XWPFSDT) bodyElement).getContent().getText() + '\n'); + t.append(((XWPFSDT) bodyElement).getContent().getText()).append('\n'); } } return t.toString(); @@ -167,9 +170,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo * if there is a corresponding {@link XWPFTable} of the parameter ctTable in the tableList of this header * the method will return this table * if there is no corresponding {@link XWPFTable} the method will return null - * - * @param ctTable */ + @Override public XWPFTable getTable(CTTbl ctTable) { for (XWPFTable table : tables) { if (table == null) @@ -193,6 +195,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo * Returns the paragraph that holds * the text of the header or footer. */ + @Override public XWPFParagraph getParagraphArray(int pos) { if(pos >= 0 && pos= 0 && pos < tables.size()) { return tables.get(pos); @@ -483,10 +481,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo /** * inserts an existing XWPFTable to the arrays bodyElements and tables - * - * @param pos - * @param table */ + @Override public void insertTable(int pos, XWPFTable table) { bodyElements.add(pos, table); int i = 0; @@ -526,9 +522,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo /** * get the TableCell which belongs to the TableCell - * - * @param cell */ + @Override public XWPFTableCell getTableCell(CTTc cell) { XmlCursor cursor = cell.newCursor(); cursor.toParent(); @@ -553,6 +548,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo return tableRow.getTableCell(cell); } + @Override public XWPFDocument getXWPFDocument() { if (document != null) { return document; @@ -567,9 +563,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo /** * returns the Part, to which the body belongs, which you need for adding relationship to other parts - * - * @see org.apache.poi.xwpf.usermodel.IBody#getPart() */ + @Override public POIXMLDocumentPart getPart() { return this; } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java index bbf59867d1..c2228ce143 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java @@ -33,11 +33,11 @@ import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STOnOff1; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; /** - *

    A Paragraph within a Document, Table, Header etc.

    - *

    - *

    A paragraph has a lot of styling information, but the + * A Paragraph within a Document, Table, Header etc.

    + * + * A paragraph has a lot of styling information, but the * actual text (possibly along with more styling) is held on - * the child {@link XWPFRun}s.

    + * the child {@link XWPFRun}s. */ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Paragraph { private final CTP paragraph; @@ -49,7 +49,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para protected List runs; protected List iruns; - private StringBuilder footnoteText = new StringBuilder(64); + private final StringBuilder footnoteText = new StringBuilder(64); public XWPFParagraph(CTP prgrph, IBody part) { this.paragraph = prgrph; @@ -176,8 +176,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * Return literal runs and sdt/content control objects. - * - * @return List */ public List getIRuns() { return Collections.unmodifiableList(iruns); @@ -252,8 +250,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * setNumID of Paragraph - * - * @param numPos */ public void setNumID(BigInteger numPos) { if (paragraph.getPPr() == null) { @@ -271,7 +267,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * setNumILvl of Paragraph * - * @param iLvl * @since 4.1.2 */ public void setNumILvl(BigInteger iLvl) { @@ -484,13 +479,11 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para * Returns the paragraph alignment which shall be applied to text in this * paragraph. *

    - *

    * If this element is not set on a given paragraph, its value is determined * by the setting previously set at any level of the style hierarchy (i.e. * that previous setting remains unchanged). If this setting is never * specified in the style hierarchy, then no alignment is applied to the * paragraph. - *

    * * @return the paragraph alignment of this paragraph. */ @@ -504,13 +497,11 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para * Specifies the paragraph alignment which shall be applied to text in this * paragraph. *

    - *

    * If this element is not set on a given paragraph, its value is determined * by the setting previously set at any level of the style hierarchy (i.e. * that previous setting remains unchanged). If this setting is never * specified in the style hierarchy, then no alignment is applied to the * paragraph. - *

    * * @param align the paragraph alignment to apply to this paragraph. */ @@ -610,7 +601,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para * Specifies the border which shall be displayed above a set of paragraphs * which have the same set of paragraph border settings. *

    - *

    * To determine if any two adjoining paragraphs shall have an individual top * and bottom border or a between border, the set of borders on the two * adjoining paragraphs are compared. If the border information on those two @@ -620,14 +610,13 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para * respectively. If this border specifies a space attribute, that value * determines the space above the text (ignoring any spacing above) which * should be left before this border is drawn, specified in points. - *

    *

    * If this element is omitted on a given paragraph, its value is determined * by the setting previously set at any level of the style hierarchy (i.e. * that previous setting remains unchanged). If this setting is never * specified in the style hierarchy, then no between border shall be applied * above identical paragraphs. - *

    + *

    * This border can only be a line border. * * @param border one of the defined Border styles, see {@link Borders} @@ -1466,8 +1455,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * add a new run at the end of the position of * the content of parameter run - * - * @param run */ protected void addRun(CTR run) { int pos; @@ -1643,9 +1630,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * verifies that cursor is on the right position - * - * @param cursor - * @return */ private boolean isCursorInParagraph(XmlCursor cursor) { XmlCursor verify = cursor.newCursor(); @@ -1659,9 +1643,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para * this methods parse the paragraph and search for the string searched. * If it finds the string, it will return true and the position of the String * will be saved in the parameter startPos. - * - * @param searched - * @param startPos */ public TextSegment searchText(String searched, PositionInParagraph startPos) { int startRun = startPos.getRun(), @@ -1731,8 +1712,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * get a Text - * - * @param segment */ public String getText(TextSegment segment) { int runBegin = segment.getBeginRun(); @@ -1770,7 +1749,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * removes a Run at the position pos in the paragraph * - * @param pos * @return true if the run was removed */ public boolean removeRun(int pos) { @@ -1810,9 +1788,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * Is there only one ctHyperlink in all runs * - * @param run - * hyperlink run - * @return + * @param run hyperlink run */ private boolean isTheOnlyCTHyperlinkInRuns(XWPFHyperlinkRun run) { CTHyperlink ctHyperlink = run.getCTHyperlink(); @@ -1825,9 +1801,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * Is there only one ctField in all runs * - * @param run - * field run - * @return + * @param run field run */ private boolean isTheOnlyCTFieldInRuns(XWPFFieldRun run) { CTSimpleField ctField = run.getCTField(); @@ -1838,8 +1812,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * returns the type of the BodyElement Paragraph - * - * @see org.apache.poi.xwpf.usermodel.IBodyElement#getElementType() */ @Override public BodyElementType getElementType() { @@ -1876,8 +1848,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * adds a new Run to the Paragraph - * - * @param r */ public void addRun(XWPFRun r) { if (!runs.contains(r)) { @@ -1887,8 +1857,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para /** * return the XWPFRun-Element which owns the CTR run-Element - * - * @param r */ public XWPFRun getRun(CTR r) { for (int i = 0; i < getRuns().size(); i++) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java index 8df9e3f806..072a48a091 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java @@ -73,9 +73,9 @@ public class XWPFSettings extends POIXMLDocumentPart { * it sets the value of zoom *
    * sample snippet from settings.xml - *

    -     *    <w:zoom w:percent="50" />
    -     * 
    +     * 
    {@code
    +     *    
    +     * }
    * * @return percentage as an integer of zoom level */ @@ -97,9 +97,9 @@ public class XWPFSettings extends POIXMLDocumentPart { * it sets the value of zoom *
    * sample snippet from settings.xml - *
    -     *    <w:zoom w:percent="50" />
    -     * 
    +     * 
    {@code
    +     *    
    +     * }
    */ public void setZoomPercent(long zoomPercent) { if (!ctSettings.isSetZoom()) { @@ -365,7 +365,7 @@ public class XWPFSettings extends POIXMLDocumentPart { /** * Check if revision tracking is turned on. * - * @return true if revision tracking is turned on + * @return {@code true} if revision tracking is turned on */ public boolean isTrackRevisions() { return ctSettings.isSetTrackRevisions(); @@ -374,7 +374,7 @@ public class XWPFSettings extends POIXMLDocumentPart { /** * Enable or disable revision tracking. * - * @param enable true to turn on revision tracking, false to turn off revision tracking + * @param enable {@code true} to turn on revision tracking, {@code false} to turn off revision tracking */ public void setTrackRevisions(boolean enable) { if (enable) { @@ -432,8 +432,8 @@ public class XWPFSettings extends POIXMLDocumentPart { /** * Turn separate even-and-odd headings on or off * - * @param enable true to turn on separate even and odd headings, - * false to turn off even and odd headings. + * @param enable {@code true} to turn on separate even and odd headings, + * {@code false} to turn off even and odd headings. */ public void setEvenAndOddHeadings(boolean enable) { CTOnOff onOff = CTOnOff.Factory.newInstance(); @@ -453,8 +453,8 @@ public class XWPFSettings extends POIXMLDocumentPart { /** * Turn mirrored margins on or off * - * @param enable true to turn on mirrored margins, - * false to turn off mirrored marginss. + * @param enable {@code true} to turn on mirrored margins, + * {@code false} to turn off mirrored marginss. */ public void setMirrorMargins(boolean enable) { CTOnOff onOff = CTOnOff.Factory.newInstance(); diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/HeadersFootersAtom.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/HeadersFootersAtom.java index 9d51daa0fc..049776f5e2 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/HeadersFootersAtom.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/HeadersFootersAtom.java @@ -129,15 +129,15 @@ public final class HeadersFootersAtom extends RecordAtom { /** * record header */ - private byte[] _header; + private final byte[] _header; /** * record data */ - private byte[] _recdata; + private final byte[] _recdata; /** - * Build an instance of HeadersFootersAtom from on-disk data + * Build an instance of {@code HeadersFootersAtom} from on-disk data */ protected HeadersFootersAtom(byte[] source, int start, int len) { // Get the header @@ -148,7 +148,7 @@ public final class HeadersFootersAtom extends RecordAtom { } /** - * Create a new instance of HeadersFootersAtom + * Create a new instance of {@code HeadersFootersAtom} */ public HeadersFootersAtom() { _recdata = new byte[4]; @@ -158,6 +158,7 @@ public final class HeadersFootersAtom extends RecordAtom { LittleEndian.putInt(_header, 4, _recdata.length); } + @Override public long getRecordType() { return RecordTypes.HeadersFootersAtom.typeID; } @@ -165,7 +166,8 @@ public final class HeadersFootersAtom extends RecordAtom { /** * Write the contents of the record back, so it can be written to disk */ - public void writeOut(OutputStream out) throws IOException { + @Override + public void writeOut(OutputStream out) throws IOException { out.write(_header); out.write(_recdata); } @@ -173,10 +175,9 @@ public final class HeadersFootersAtom extends RecordAtom { /** * A signed integer that specifies the format ID to be used to style the datetime. *

    - * It MUST be in the range [0, 12].
    + * It MUST be in the range [0, 12].

    * This value is converted into a string as specified by the index field of the DateTimeMCAtom record. * It MUST be ignored unless fHasTodayDate is TRUE. - * * * @return A signed integer that specifies the format ID to be used to style the datetime. */ @@ -196,6 +197,7 @@ public final class HeadersFootersAtom extends RecordAtom { /** * A bit mask specifying options for displaying headers and footers * + *

      *
    • A - {@link #fHasDate} (1 bit): A bit that specifies whether the date is displayed in the footer. *
    • B - {@link #fHasTodayDate} (1 bit): A bit that specifies whether the current datetime is used for * displaying the datetime. @@ -207,6 +209,7 @@ public final class HeadersFootersAtom extends RecordAtom { *
    • F - {@link #fHasFooter} (1 bit): A bit that specifies whether the footer text specified by FooterAtom * record is displayed. *
    • reserved (10 bits): MUST be zero and MUST be ignored. + *
    * * @return A bit mask specifying options for displaying headers and footers */ diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/InteractiveInfoAtom.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/InteractiveInfoAtom.java index 5b60c632fc..e5e5ccbb6c 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/InteractiveInfoAtom.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/InteractiveInfoAtom.java @@ -121,12 +121,12 @@ public class InteractiveInfoAtom extends RecordAtom { /** * Record header. */ - private byte[] _header; + private final byte[] _header; /** * Record data. */ - private byte[] _data; + private final byte[] _data; /** * Constructs a brand new link related atom record. @@ -203,7 +203,7 @@ public class InteractiveInfoAtom extends RecordAtom { /** * Hyperlink Action. *

    - * see ACTION_* constants for the list of actions + * see {@code ACTION_*} constants for the list of actions *

    * * @return hyperlink action. @@ -215,7 +215,7 @@ public class InteractiveInfoAtom extends RecordAtom { /** * Hyperlink Action *

    - * see ACTION_* constants for the list of actions + * see {@code ACTION_*} constants for the list of actions *

    * * @param val hyperlink action. @@ -241,7 +241,7 @@ public class InteractiveInfoAtom extends RecordAtom { /** * Jump *

    - * see JUMP_* constants for the list of actions + * see {@code JUMP_*} constants for the list of actions *

    * * @return jump @@ -253,7 +253,7 @@ public class InteractiveInfoAtom extends RecordAtom { /** * Jump *

    - * see JUMP_* constants for the list of actions + * see {@code JUMP_*} constants for the list of actions *

    * * @param val jump @@ -264,12 +264,12 @@ public class InteractiveInfoAtom extends RecordAtom { /** * Flags - *

    + *

      *
    • Bit 1: Animated. If 1, then button is animated *
    • Bit 2: Stop sound. If 1, then stop current sound when button is pressed. *
    • Bit 3: CustomShowReturn. If 1, and this is a jump to custom show, * then return to this slide after custom show. - *

      + *
    */ public byte getFlags() { return _data[11]; @@ -277,12 +277,12 @@ public class InteractiveInfoAtom extends RecordAtom { /** * Flags - *

    + *

      *
    • Bit 1: Animated. If 1, then button is animated *
    • Bit 2: Stop sound. If 1, then stop current sound when button is pressed. *
    • Bit 3: CustomShowReturn. If 1, and this is a jump to custom show, * then return to this slide after custom show. - *

      + *
    */ public void setFlags(byte val) { _data[11] = val; @@ -310,6 +310,7 @@ public class InteractiveInfoAtom extends RecordAtom { * Gets the record type. * @return the record type. */ + @Override public long getRecordType() { return RecordTypes.InteractiveInfoAtom.typeID; } /** @@ -319,6 +320,7 @@ public class InteractiveInfoAtom extends RecordAtom { * @param out the output stream to write to. * @throws IOException if an error occurs. */ + @Override public void writeOut(OutputStream out) throws IOException { out.write(_header); out.write(_data); diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java index 7bd098f92b..0836ce98f1 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java @@ -38,7 +38,7 @@ import org.apache.poi.util.LittleEndianConsts; *
    * * Combination of effectType and effectDirection: - * + *
    * * * @@ -137,7 +137,7 @@ public class SSSlideInfoAtom extends RecordAtom { private static final long _type = RecordTypes.SSSlideInfoAtom.typeID; - private byte[] _header; + private final byte[] _header; /** * A signed integer that specifies an amount of time, in milliseconds, to wait @@ -175,7 +175,7 @@ public class SSSlideInfoAtom extends RecordAtom { * (0x00 = 0.75 seconds, 0x01 = 0.5 seconds, 0x02 = 0.25 seconds) */ private short _speed; // byte - private byte[] _unused; // 3-byte + private final byte[] _unused; // 3-byte public SSSlideInfoAtom() { _header = new byte[8]; @@ -222,6 +222,7 @@ public class SSSlideInfoAtom extends RecordAtom { * Write the contents of the record back, so it can be written * to disk */ + @Override public void writeOut(OutputStream out) throws IOException { // Header - size or type unchanged out.write(_header); @@ -245,6 +246,7 @@ public class SSSlideInfoAtom extends RecordAtom { /** * We are of type 1017 */ + @Override public long getRecordType() { return _type; } @@ -290,8 +292,6 @@ public class SSSlideInfoAtom extends RecordAtom { /** * Use one of the bitmasks MANUAL_ADVANCE_BIT ... CURSOR_VISIBLE_BIT - * @param bitmask - * @param enabled */ public void setEffectTransitionFlagByBit(int bitmask, boolean enabled) { if (enabled) { diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFHyperlink.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFHyperlink.java index 5575d16bb7..be27af04fe 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFHyperlink.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFHyperlink.java @@ -50,15 +50,15 @@ public final class HSLFHyperlink implements HyperlinkLINK_* constant + * Must be a {@code LINK_*} constant * * @return the hyperlink URL * @see InteractiveInfoAtom @@ -300,8 +300,8 @@ public final class HSLFHyperlink implements HyperlinkTextRun to lookup hyperlinks in - * @return found hyperlinks or null if not found + * @param shape {@code TextRun} to lookup hyperlinks in + * @return found hyperlinks or {@code null} if not found */ public static List find(HSLFTextShape shape){ return find(shape.getTextParagraphs()); @@ -310,7 +310,7 @@ public final class HSLFHyperlink implements HyperlinkTextParagraph to lookup hyperlinks + * @param paragraphs List of {@code TextParagraph} to lookup hyperlinks * @return found hyperlinks */ @SuppressWarnings("resource") @@ -334,8 +334,8 @@ public final class HSLFHyperlink implements HyperlinkShape to lookup hyperlink in - * @return found hyperlink or null + * @param shape {@code Shape} to lookup hyperlink in + * @return found hyperlink or {@code null} */ @SuppressWarnings("resource") protected static HSLFHyperlink find(HSLFShape shape){ diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfBinaryRasterOp.java b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfBinaryRasterOp.java index 5325931dbe..cf50d43719 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfBinaryRasterOp.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfBinaryRasterOp.java @@ -29,14 +29,14 @@ import java.util.function.BiConsumer; * selected pen and the destination bitmap are combined. Following are the two operands used in these * operations. * - *
    typedescriptiondirection
    0cut0x00 = no transition, 0x01 = black transition
    1random0x00
    + *
    * * * *
    OperandMeaning
    PSelected pen
    DDestination bitmap
    * * Following are the Boolean operators used in these operations. - * + *
    * * * @@ -54,7 +54,7 @@ import java.util.function.BiConsumer; * (in this case, the pen and destination values). For example, the operation indexes for the DPo and * DPan operations are shown in the following list. * - *
    OperandMeaning
    aBitwise AND
    nBitwise NOT (inverse)
    + *
    * * * diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfMisc.java b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfMisc.java index b4ecc2fc3c..df252a35c1 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfMisc.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfMisc.java @@ -72,10 +72,12 @@ public class HwmfMisc { * The META_SETRELABS record is reserved and not supported. */ public static class WmfSetRelabs implements HwmfRecord { + @Override public HwmfRecordType getWmfRecordType() { return HwmfRecordType.setRelabs; } + @Override public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException { return 0; } @@ -186,7 +188,7 @@ public class HwmfMisc { public enum HwmfBkMode { TRANSPARENT(0x0001), OPAQUE(0x0002); - int flag; + final int flag; HwmfBkMode(int flag) { this.flag = flag; } @@ -201,10 +203,12 @@ public class HwmfMisc { protected HwmfBkMode bkMode; + @Override public HwmfRecordType getWmfRecordType() { return HwmfRecordType.setBkMode; } + @Override public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException { bkMode = HwmfBkMode.valueOf(leis.readUShort()); return LittleEndianConsts.SHORT_SIZE; @@ -752,7 +756,7 @@ public class HwmfMisc { * The following table shows the relationship between values in the BrushStyle, * ColorRef and BrushHatch fields in a LogBrush Object. Only supported brush styles are listed. * - *
    PDDPoDPan
    0001
    0111
    + *
    * * * diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfTernaryRasterOp.java b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfTernaryRasterOp.java index 2f79af4087..c84601e2b1 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfTernaryRasterOp.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfTernaryRasterOp.java @@ -25,7 +25,7 @@ import java.util.Deque; * the source, the selected brush, and the destination are combined. Following are the three operands * used in these operations. * - *
    BrushStyleColorRef
    + *
    * * * @@ -33,7 +33,7 @@ import java.util.Deque; *
    OperandMeaning
    DDestination bitmap
    PSelected brush (also called pattern)
    * * Following are the Boolean operators used in these operations. - * + *
    * * * @@ -55,7 +55,7 @@ import java.util.Deque; * values. For example, the operation indexes for the PSo and DPSoo operations are shown in the * following list. * - *
    OperandMeaning
    aBitwise AND
    nBitwise NOT (inverse)
    + *
    * * * diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/HRESIAbstractType.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/HRESIAbstractType.java index d4e410e2a3..82d5201354 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/HRESIAbstractType.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/HRESIAbstractType.java @@ -67,21 +67,19 @@ public abstract class HRESIAbstractType { public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("[HRESI]\n"); - builder.append(" .hres = "); - builder.append(" (").append(getHres()).append(" )\n"); - builder.append(" .chHres = "); - builder.append(" (").append(getChHres()).append(" )\n"); - - builder.append("[/HRESI]\n"); - return builder.toString(); + return "[HRESI]\n" + + " .hres = " + + " (" + getHres() + " )\n" + + " .chHres = " + + " (" + getChHres() + " )\n" + + "[/HRESI]\n"; } /** * Hyphenation rule. * * @return One of + *
      *
    • {@link #HRES_NO} *
    • {@link #HRES_NORMAL} *
    • {@link #HRES_ADD_LETTER_BEFORE} @@ -89,6 +87,7 @@ public abstract class HRESIAbstractType { *
    • {@link #HRES_DELETE_LETTER_BEFORE} *
    • {@link #HRES_CHANGE_LETTER_AFTER} *
    • {@link #HRES_DELETE_BEFORE_CHANGE_BEFORE} + *
    */ public byte getHres() { @@ -98,8 +97,8 @@ public abstract class HRESIAbstractType { /** * Hyphenation rule. * - * @param field_1_hres - * One of + * @param field_1_hres One of + *
      *
    • {@link #HRES_NO} *
    • {@link #HRES_NORMAL} *
    • {@link #HRES_ADD_LETTER_BEFORE} @@ -107,6 +106,7 @@ public abstract class HRESIAbstractType { *
    • {@link #HRES_DELETE_LETTER_BEFORE} *
    • {@link #HRES_CHANGE_LETTER_AFTER} *
    • {@link #HRES_DELETE_BEFORE_CHANGE_BEFORE} + *
    */ public void setHres( byte field_1_hres ) {
    PSDDPoDPan
    00000
    00101