Skip to content

Commit

Permalink
refactor: address JDT warnings "hiding"
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-rew committed Oct 30, 2023
1 parent bbea83f commit 2edf470
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 234 deletions.
170 changes: 84 additions & 86 deletions doc-factory/src/ch/ivyteam/ivy/addons/docfactory/AsposeDocFactory.java

Large diffs are not rendered by default.

131 changes: 65 additions & 66 deletions doc-factory/src/ch/ivyteam/ivy/addons/docfactory/BaseDocFactory.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -512,16 +512,15 @@ public <T> DocumentTemplate withDocumentWorker(T documentWorker) {

/**
* Allows specifying a Locale for formatting the Numbers and Dates objects
* @param locale
* @param newLocale
* @return The DocumenTemplate which Locale as been set.
*/
@SuppressWarnings("hiding")
public DocumentTemplate useLocale(Locale locale) {
if (locale != null) {
this.locale = locale;
public DocumentTemplate useLocale(Locale newLocale) {
if (newLocale != null) {
this.locale = newLocale;
}
for (TemplateMergeField tmf : this.mergeFields) {
tmf.useLocaleAndResetNumberFormatAndDateFormat(locale);
tmf.useLocaleAndResetNumberFormatAndDateFormat(newLocale);
}
return this;
}
Expand Down Expand Up @@ -956,10 +955,9 @@ public DocumentCreationOptions getDocumentCreationOptions() {
return documentCreationOptions;
}

@SuppressWarnings("hiding")
public DocumentTemplate withDocumentCreationOptions(DocumentCreationOptions documentCreationOptions) {
API.checkNotNull(documentCreationOptions, "documentCreationOptions");
this.documentCreationOptions = documentCreationOptions;
public DocumentTemplate withDocumentCreationOptions(DocumentCreationOptions options) {
API.checkNotNull(options, "options");
this.documentCreationOptions = options;
this.documentFactory.withDocumentCreationOptions(this.documentCreationOptions);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
* with its generateDocument methods.
*
*/
@SuppressWarnings("hiding")
public class AsposeDocFactoryFileGenerator {

private DocumentCreationOptions documentCreationOptions = DocumentCreationOptions.getInstance();
Expand All @@ -55,15 +54,14 @@ public static AsposeDocFactoryFileGenerator getInstance() {
/**
* The DocumentCreationOptions contains diverse options for the final file
* generation (e.g should a PDF be editable ...)
* @param documentCreationOptions the DocumentCreationOptions object, cannot
* @param options the DocumentCreationOptions object, cannot
* be null.
* @return the AsposeDocFactoryFileGenerator object which
* DocumentCreationOptions has been set.
*/
public AsposeDocFactoryFileGenerator withDocumentCreationOptions(
DocumentCreationOptions documentCreationOptions) {
API.checkNotNull(documentCreationOptions, "documentCreationOptions");
this.documentCreationOptions = documentCreationOptions;
public AsposeDocFactoryFileGenerator withDocumentCreationOptions(DocumentCreationOptions options) {
API.checkNotNull(options, "options");
this.documentCreationOptions = options;
return this;
}

Expand All @@ -72,14 +70,14 @@ public AsposeDocFactoryFileGenerator withDocumentCreationOptions(
* this AsposeDocFactoryFileGenerator. If set the
* {@link ch.ivyteam.ivy.addons.docfactory.aspose.DocumentWorker#onGeneratedFile(Document, File)}
* logic will be applied after the file has been generated
* @param documentWorker the
* @param worker the
* {@link ch.ivyteam.ivy.addons.docfactory.aspose.DocumentWorker}
* implementation to set. Null is accepted.
* @return the AsposeDocFactoryFileGenerator object which documentWorker has
* been set.
*/
public AsposeDocFactoryFileGenerator withDocumentWorker(DocumentWorker documentWorker) {
this.documentWorker = documentWorker;
public AsposeDocFactoryFileGenerator withDocumentWorker(DocumentWorker worker) {
this.documentWorker = worker;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ public AsposeFieldMergingCallback removeNullValuesLines(boolean removeNullValues
* <ul>
* <li>displayBooleanValuesAsCheckBox
* </ul>
* @param documentCreationOptions the DocumentCreationOptions object. If null
* @param options the DocumentCreationOptions object. If null
* throws an IllegalArgumentException
* @return the current AsposeFieldMergingCallback object
*/
@SuppressWarnings("hiding")
public AsposeFieldMergingCallback withDocumentCreationOptions(
DocumentCreationOptions documentCreationOptions) {
API.checkNotNull(documentCreationOptions, "documentCreationOptions");
this.documentCreationOptions = documentCreationOptions;
public AsposeFieldMergingCallback withDocumentCreationOptions(DocumentCreationOptions options) {
API.checkNotNull(options, "options");
this.documentCreationOptions = options;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ public interface DocumentWorker {
* @param document the aspose words Document upon which the mail merge will be
* performed.
*/
@SuppressWarnings("unused")
default void prepare(Document document) {

default void prepare(@SuppressWarnings("all") Document document) {
}

/**
Expand All @@ -33,9 +32,7 @@ default void prepare(Document document) {
* @param document the aspose words Document upon which the mail merge has
* been performed.
*/
@SuppressWarnings("unused")
default void postCreate(Document document) {

default void postCreate(@SuppressWarnings("all") Document document) {
}

/**
Expand All @@ -58,7 +55,7 @@ default void postCreate(Document document) {
* the result file must exist (file.isFile() must return true). Else
* the DocFactory will throw a DocumentGenerationException.
*/
@SuppressWarnings("unused")
@SuppressWarnings("all")
default File onGeneratedFile(Document document, File generatedFile) {
return generatedFile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public <T> MailMergeDataSource(java.util.Collection<T> dataSourceObjects) {
// makeListOfChildrenDataSourceInComposite(dataSourceObjects);
}

@SuppressWarnings("unchecked")
@SuppressWarnings("all")
private void makeListOfChildrenDataSourceInComposite(List<CompositeObject> dataSourceObjects) {
this.nestedChildrenDatasources = List.create(MetaType.listOf(MetaType.listOf(CompositeObject.class)));
for (int j = 0; j < dataSourceObjects.size(); j++) {
Expand Down Expand Up @@ -313,7 +313,7 @@ public IMailMergeDataSource getChildDataSource(String _tablename)
return null;
}

void putChildMailMergeDataSource(IMailMergeDataSource mmds, @SuppressWarnings("unused") String tblName) {
void putChildMailMergeDataSource(IMailMergeDataSource mmds, @SuppressWarnings("all") String tblName) {
if (mmds == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import java.util.Collection;

import com.aspose.words.IMailMergeDataSource;

import ch.ivyteam.api.API;
import ch.ivyteam.ivy.addons.docfactory.TemplateMergeField;
import ch.ivyteam.ivy.addons.docfactory.mergefield.TemplateMergeFieldType;
import ch.ivyteam.ivy.addons.docfactory.mergefield.internal.MergeFieldsExtractor;
import ch.ivyteam.ivy.scripting.objects.Record;
import ch.ivyteam.ivy.scripting.objects.Recordset;

import com.aspose.words.IMailMergeDataSource;

public class MailMergeDataSourceGenerator {

private Recordset recordset = new Recordset();
Expand Down Expand Up @@ -73,8 +73,8 @@ private static IMailMergeDataSource makeEmbeddedMailMergeDataSources(IMailMergeD
IMailMergeDataSource childMailMergeDataSource = null;
if (templateMergeField.isPossibleTableData() && templateMergeField.isCollection()) {
childMailMergeDataSource = getFromCollectionTypeTemplateMergeField(templateMergeField, parentTableName);
parentDataSource.putChildMailMergeDataSource(childMailMergeDataSource,
simplifiedName + getSecondPart(templateMergeField.getMergeFieldName()));
String tblName = simplifiedName + getSecondPart(templateMergeField.getMergeFieldName());
parentDataSource.putChildMailMergeDataSource(childMailMergeDataSource, tblName);
}
if (templateMergeField.isPossibleTableData()
&& templateMergeField.getType().is(TemplateMergeFieldType.OBJECT)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import ch.ivyteam.api.API;
import ch.ivyteam.ivy.addons.docfactory.pdf.PdfOptions;

@SuppressWarnings("hiding")
public class DocumentCreationOptions {

private PdfOptions pdfOptions = PdfOptions.getInstance();
Expand All @@ -19,11 +18,11 @@ public static DocumentCreationOptions getInstance() {

/**
* returns the DocumentCreationOptions which {@link PdfOptions} has been set.
* @param pdfOptions the {@link PdfOptions} to set. Cannot be null.
* @param options the {@link PdfOptions} to set. Cannot be null.
*/
public DocumentCreationOptions withPdfOptions(PdfOptions pdfOptions) {
API.checkNotNull(pdfOptions, "the pdfOptions");
this.pdfOptions = pdfOptions;
public DocumentCreationOptions withPdfOptions(PdfOptions options) {
API.checkNotNull(options, "options");
this.pdfOptions = options;
return this;
}

Expand All @@ -48,13 +47,13 @@ public DocumentCreationOptions removeWhiteSpaceInPdfEditableFields(
return this;
}

public DocumentCreationOptions displayBooleanValuesAsCheckBox(boolean displayBooleanValuesAsCheckBox) {
this.displayBooleanValuesAsCheckBox = displayBooleanValuesAsCheckBox;
public DocumentCreationOptions displayBooleanValuesAsCheckBox(boolean checkbox) {
this.displayBooleanValuesAsCheckBox = checkbox;
return this;
}

public DocumentCreationOptions removeBlankPages(boolean removeBlankPages) {
this.removeBlankPages = removeBlankPages;
public DocumentCreationOptions removeBlankPages(boolean remove) {
this.removeBlankPages = remove;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* may be appended together in a common file.
* @since version 7.3.0
*/
@SuppressWarnings("hiding")
public class FileAppenderOptions {

private String appendedSingleFileName = DocFactoryConstants.DEFAULT_FILE_NAME;
Expand All @@ -43,13 +42,13 @@ public static FileAppenderOptions getInstance() {
* Note: if you don't set this property, a default file name will be used for
* producing the appended file (see
* {@link DocFactoryConstants#DEFAULT_FILE_NAME}.
* @param appendedSingleFileName the file name of the file which will be
* @param fileName the file name of the file which will be
* produced by appending a bunch of other documents or files. Cannot
* be blank.
*/
public FileAppenderOptions withAppendedFileName(String appendedSingleFileName) {
API.checkNotEmpty(appendedSingleFileName, "String appendedSingleFileName");
this.appendedSingleFileName = appendedSingleFileName;
public FileAppenderOptions withAppendedFileName(String fileName) {
API.checkNotEmpty(fileName, "fileName");
this.appendedSingleFileName = fileName;
return this;
}

Expand Down Expand Up @@ -80,11 +79,11 @@ public FileAppenderOptions withAppendedFileParentDirectoryPath(String outputDire
* <b>Note: </b><u>Applies only for appending Words documents (doc, docx and
* odt) together, or for appending documents at mail merge time</u>. Has no
* effect if used for appending existing PDF files together.
* @param restartPageNumbering true if you want that each appended document
* @param restart true if you want that each appended document
* has its own page numbering. Else leave it false (default).
*/
public FileAppenderOptions restartPageNumbering(boolean restartPageNumbering) {
this.restartPageNumbering = restartPageNumbering;
public FileAppenderOptions restartPageNumbering(boolean restart) {
this.restartPageNumbering = restart;
return this;
}

Expand All @@ -95,12 +94,12 @@ public FileAppenderOptions restartPageNumbering(boolean restartPageNumbering) {
* <b>Note: </b><u>Applies only for appending Words documents (doc, docx and
* odt) together, or for appending documents at mail merge time</u>. Has no
* effect if used for appending existing PDF files together.
* @param useHeadersFootersFromLeadingPage true if you want that each appended
* @param useLeading true if you want that each appended
* document uses the header and footer from leading page. Else leave
* it false (default).
*/
public FileAppenderOptions useHeadersFootersFromLeadingPage(boolean useHeadersFootersFromLeadingPage) {
this.useHeadersFootersFromLeadingPage = useHeadersFootersFromLeadingPage;
public FileAppenderOptions useHeadersFootersFromLeadingPage(boolean useLeading) {
this.useHeadersFootersFromLeadingPage = useLeading;
return this;
}

Expand All @@ -110,10 +109,10 @@ public FileAppenderOptions useHeadersFootersFromLeadingPage(boolean useHeadersFo
* page ({@link DocumentAppendingStart#NEW_PAGE}). The
* {@link DocumentAppendingStart#CONTINUOUS} allows appending the documents
* continuously without page break.
* @param documentAppendingStart
* @param appendigStart
*/
public FileAppenderOptions withDocumentAppendingStart(DocumentAppendingStart documentAppendingStart) {
this.documentAppendingStart = documentAppendingStart;
public FileAppenderOptions withDocumentAppendingStart(DocumentAppendingStart appendigStart) {
this.documentAppendingStart = appendigStart;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.apache.commons.lang3.builder.HashCodeBuilder;

@SuppressWarnings("hiding")
public class MergeCleanupOptions extends SimpleMergeCleanupOptions {

private boolean removesUnusedRegions = true;
Expand All @@ -13,18 +12,18 @@ public static MergeCleanupOptions getRecommendedMergeCleanupOptionsForMergingWit
return new MergeCleanupOptions();
}

public MergeCleanupOptions removingContainingFields(boolean removesContainingFields) {
this.removesContainingFields = removesContainingFields;
public MergeCleanupOptions removingContainingFields(boolean removeContaining) {
this.removesContainingFields = removeContaining;
return this;
}

public MergeCleanupOptions removingUnusedRegions(boolean removesUnusedRegions) {
this.removesUnusedRegions = removesUnusedRegions;
public MergeCleanupOptions removingUnusedRegions(boolean removeRegions) {
this.removesUnusedRegions = removeRegions;
return this;
}

public MergeCleanupOptions removingUnusedFields(boolean removesUnusedFields) {
this.removesUnusedFields = removesUnusedFields;
public MergeCleanupOptions removingUnusedFields(boolean removeFields) {
this.removesUnusedFields = removeFields;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* appending other files or documents.
* </ul>
*/
@SuppressWarnings("hiding")
public class MultipleDocumentsCreationOptions {

private boolean createSingleFileForEachDocument = true;
Expand All @@ -33,29 +32,27 @@ public static MultipleDocumentsCreationOptions getInstance() {
* Used by the DocFactory in its
* {@link ch.ivyteam.ivy.addons.docfactory.BaseDocFactory#generateDocuments(java.util.List, MultipleDocumentsCreationOptions)}
* method.
* @param createSingleFileForEachDocument if true each given documentTemplate
* @param singleFiles if true each given documentTemplate
* will generate one single document file. By default this is true.
* You can set it false, if you want to only generate a single file
* by appending all the Documents in one file. See
* {@link MultipleDocumentsCreationOptions#createOneFileByAppendingAllTheDocuments(boolean)}
*/
public MultipleDocumentsCreationOptions createSingleFileForEachDocument(
boolean createSingleFileForEachDocument) {
this.createSingleFileForEachDocument = createSingleFileForEachDocument;
public MultipleDocumentsCreationOptions createSingleFileForEachDocument(boolean singleFiles) {
this.createSingleFileForEachDocument = singleFiles;
return this;
}

/**
* Used by the DocFactory in its
* {@link ch.ivyteam.ivy.addons.docfactory.BaseDocFactory#generateDocuments(java.util.List, MultipleDocumentsCreationOptions)}
* method.
* @param createOneFileByAppendingAllTheDocuments if true, the
* @param appendAllDocs if true, the
* DocumentTemplates will be appended in one file which name is set
* it this DocumentAppenderOptions object by its method.
*/
public MultipleDocumentsCreationOptions createOneFileByAppendingAllTheDocuments(
boolean createOneFileByAppendingAllTheDocuments) {
this.createOneFileByAppendingAllTheDocuments = createOneFileByAppendingAllTheDocuments;
public MultipleDocumentsCreationOptions createOneFileByAppendingAllTheDocuments(boolean appendAllDocs) {
this.createOneFileByAppendingAllTheDocuments = appendAllDocs;
return this;
}

Expand All @@ -64,12 +61,12 @@ public MultipleDocumentsCreationOptions createOneFileByAppendingAllTheDocuments(
* {@link ch.ivyteam.ivy.addons.docfactory.BaseDocFactory#generateDocuments(java.util.List, MultipleDocumentsCreationOptions)}
* method. The FileAppenderOptions contains the options for producing a file
* appending other files or documents.
* @param fileAppenderOptions FileAppenderOptions contains the options for
* @param fileOptions FileAppenderOptions contains the options for
* producing a file appending other files or documents. Cannot be
* null.
*/
public MultipleDocumentsCreationOptions withFileAppenderOptions(FileAppenderOptions fileAppenderOptions) {
this.setFileAppenderOptions(fileAppenderOptions);
public MultipleDocumentsCreationOptions withFileAppenderOptions(FileAppenderOptions fileOptions) {
this.setFileAppenderOptions(fileOptions);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ public SimpleMergeCleanupOptions removingBlankLines(boolean removesBlankFields)
return this;
}

@SuppressWarnings("hiding")
public SimpleMergeCleanupOptions removingEmptyParagraphs(boolean removesEmptyParagraphs) {
this.removesEmptyParagraphs = removesEmptyParagraphs;
public SimpleMergeCleanupOptions removingEmptyParagraphs(boolean remove) {
this.removesEmptyParagraphs = remove;
return this;
}

Expand Down

0 comments on commit 2edf470

Please sign in to comment.