From 80ea834ea226317c108c2381dd4453022386005c Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 30 Aug 2024 16:40:13 -0700 Subject: [PATCH] More API cleanups --- .../rife/bld/extension/DokkaOperation.java | 30 +++++++++++-------- .../bld/extension/DokkaOperationTest.java | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/java/rife/bld/extension/DokkaOperation.java b/src/main/java/rife/bld/extension/DokkaOperation.java index c3e71c0..05cbcbc 100644 --- a/src/main/java/rife/bld/extension/DokkaOperation.java +++ b/src/main/java/rife/bld/extension/DokkaOperation.java @@ -373,8 +373,7 @@ public DokkaOperation globalLinks(Map globalLinks) { * @return this operation instance */ public DokkaOperation globalPackageOptions(String... options) { - globalPackageOptions_.addAll(List.of(options)); - return this; + return globalPackageOptions(List.of(options)); } /** @@ -415,8 +414,7 @@ public DokkaOperation globalPackageOptions(Collection options) { * @return this operation instance */ public DokkaOperation globalSrcLink(String... links) { - globalSrcLinks_.addAll(List.of(links)); - return this; + return globalSrcLink(List.of(links)); } /** @@ -448,6 +446,7 @@ public DokkaOperation globalSrcLink(Collection links) { * * @param files one or more files * @return this operation instance + * @see #includes(Collection) */ public DokkaOperation includes(File... files) { return includes(List.of(files)); @@ -462,6 +461,7 @@ public DokkaOperation includes(File... files) { * * @param files one or more files * @return this operation instance + * @see #includesStrings(Collection) */ public DokkaOperation includes(String... files) { return includesStrings(List.of(files)); @@ -476,6 +476,7 @@ public DokkaOperation includes(String... files) { * * @param files one or more files * @return this operation instance + * @see #includesPaths(Collection) */ public DokkaOperation includes(Path... files) { return includesPaths(List.of(files)); @@ -500,6 +501,7 @@ public Collection includes() { * * @param files the markdown files * @return this operation instance + * @see #includes(File...) */ public DokkaOperation includes(Collection files) { includes_.addAll(files); @@ -515,10 +517,10 @@ public DokkaOperation includes(Collection files) { * * @param files the markdown files * @return this operation instance + * @see #includes(Path...) */ public DokkaOperation includesPaths(Collection files) { - includes_.addAll(files.stream().map(Path::toFile).toList()); - return this; + return includes(files.stream().map(Path::toFile).toList()); } /** @@ -530,10 +532,10 @@ public DokkaOperation includesPaths(Collection files) { * * @param files the markdown files * @return this operation instance + * @see #includes(String...) */ public DokkaOperation includesStrings(Collection files) { - includes_.addAll(files.stream().map(File::new).toList()); - return this; + return includes(files.stream().map(File::new).toList()); } /** @@ -758,6 +760,7 @@ public Map pluginConfigurations() { * * @param jars one or more jars * @return this operation instance + * @see #includes(Collection) */ public DokkaOperation pluginsClasspath(File... jars) { return pluginsClasspath(List.of(jars)); @@ -768,6 +771,7 @@ public DokkaOperation pluginsClasspath(File... jars) { * * @param jars one or more jars * @return this operation instance + * @see #pluginsClasspathStrings(Collection) */ public DokkaOperation pluginsClasspath(String... jars) { return pluginsClasspathStrings(List.of(jars)); @@ -778,6 +782,7 @@ public DokkaOperation pluginsClasspath(String... jars) { * * @param jars one or more jars * @return this operation instance + * @see #pluginsClasspathPaths(Collection) */ public DokkaOperation pluginsClasspath(Path... jars) { return pluginsClasspathPaths(List.of(jars)); @@ -797,6 +802,7 @@ public Collection pluginsClasspath() { * * @param jars the jars * @return this operation instance + * @see #pluginsClasspath(Collection) */ public DokkaOperation pluginsClasspath(Collection jars) { pluginsClasspath_.addAll(jars); @@ -808,10 +814,10 @@ public DokkaOperation pluginsClasspath(Collection jars) { * * @param jars the jars * @return this operation instance + * @see #pluginsClasspath(Path...) */ public DokkaOperation pluginsClasspathPaths(Collection jars) { - pluginsClasspath_.addAll(jars.stream().map(Path::toFile).toList()); - return this; + return pluginsClasspath(jars.stream().map(Path::toFile).toList()); } /** @@ -819,10 +825,10 @@ public DokkaOperation pluginsClasspathPaths(Collection jars) { * * @param jars the jars * @return this operation instance + * @see #pluginsClasspath(String...) */ public DokkaOperation pluginsClasspathStrings(Collection jars) { - pluginsClasspath_.addAll(jars.stream().map(File::new).toList()); - return this; + return pluginsClasspath(jars.stream().map(File::new).toList()); } /** diff --git a/src/test/java/rife/bld/extension/DokkaOperationTest.java b/src/test/java/rife/bld/extension/DokkaOperationTest.java index 398fd22..ca19b54 100644 --- a/src/test/java/rife/bld/extension/DokkaOperationTest.java +++ b/src/test/java/rife/bld/extension/DokkaOperationTest.java @@ -245,7 +245,7 @@ void outputDirTest() { @Test void pluginClasspathTest() { var op = new DokkaOperation(); - + op.pluginsClasspath(List.of(new File(FILE_1), new File(FILE_2))); assertThat(op.pluginsClasspath()).as("List(File...)").containsExactly(new File(FILE_1), new File(FILE_2)); op.pluginsClasspath().clear();