Skip to content

Commit f49a60c

Browse files
Babcock, ScottBabcock, Scott
authored andcommitted
Merge pull request #4 in MFATT/common from pr/add-class-javadoc to master
* commit '3e485f5f6e4cc02aad981c7f3067ba99b0912670': Add JavaDoc; expand README content
2 parents 03296e8 + 3e485f5 commit f49a60c

File tree

3 files changed

+62
-21
lines changed

3 files changed

+62
-21
lines changed

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -165,25 +165,32 @@ public class OpctConfig extends SettingsCore<OpctConfig.OpctValues> {
165165

166166
## PathUtils
167167

168-
The **PathUtils** `getNextPath` method provides a method to acquire the next file path in sequence for the specified base name and extension in the indicated target folder.
168+
The **PathUtils** `getNextPath` method provides a method to acquire the next file path in sequence for the specified base name and extension in the indicated target folder. If the target folder already contains at least one file that matches the specified base name and extension, the algorithm used to select the next path will always return a path whose index is one more than the highest index that currently exists. (If a single file with no index is found, its implied index is 1.)
169+
170+
##### Example usage of `getNextPath`
169171

170172
```java
173+
...
174+
175+
/*
176+
* This example gets the next path in sequence for base name `artifact`
177+
* and extension `txt` in the TestNG output directory.
178+
*
179+
* For purposes of this example, the output directory already contains
180+
* the following files: `artifact.txt`, `artifact-3.txt`
181+
*/
171182

172-
/*
173-
* This example gets the next path in sequence for base name `artifact` and extension `txt` in the TestNG output directory.
174-
*
175-
* For purposes of this example, the output directory already contains the following files: `artifact.txt`, `artifact-3.txt`
176-
*/
183+
Path collectionPath = Paths.get(testContext.getOutputDirectory());
184+
// => C:\git\my-project\test-output\Default suite
177185

178-
Path collectionPath = Paths.get(testContext.getOutputDirectory());
179-
// => C:\git\my-project\test-output\Default suite
180-
181-
Path artifactPath;
182-
try {
183-
artifactPath = PathUtils.getNextPath(collectionPath, "artifact", "txt");
184-
// => C:\git\my-project\test-output\Default suite\artifact-4.txt
185-
} catch (IOException e) {
186-
provider.getLogger().info("Unable to get output path; no artifact was captured", e);
187-
return;
188-
}
189-
```
186+
Path artifactPath;
187+
try {
188+
artifactPath = PathUtils.getNextPath(collectionPath, "artifact", "txt");
189+
// => C:\git\my-project\test-output\Default suite\artifact-4.txt
190+
} catch (IOException e) {
191+
provider.getLogger().info("Unable to get output path; no artifact was captured", e);
192+
return;
193+
}
194+
195+
...
196+
```

src/main/java/com/nordstrom/common/file/PathUtils.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,40 @@
1313
import java.util.regex.Pattern;
1414
import java.util.stream.Stream;
1515

16+
/**
17+
* This utility class provides a {@link #getNextPath(Path, String, String) getNextPath} method to acquire the next file
18+
* path in sequence for the specified base name and extension in the indicated target folder. If the target folder
19+
* already contains at least one file that matches the specified base name and extension, the algorithm used to select
20+
* the next path will always return a path whose index is one more than the highest index that currently exists. (If a
21+
* single file with no index is found, its implied index is 1.)
22+
* <br><br>
23+
* <b>Example usage of {@code getNextPath}</b>
24+
* <pre>
25+
* ...
26+
*
27+
* /*
28+
* * This example gets the next path in sequence for base name `artifact`
29+
* * and extension `txt` in the TestNG output directory.
30+
* *
31+
* * For purposes of this example, the output directory already contains
32+
* * the following files: `artifact.txt`, `artifact-3.txt`
33+
* *&#47;
34+
*
35+
* Path collectionPath = Paths.get(testContext.getOutputDirectory());
36+
* // => C:\git\my-project\test-output\Default suite
37+
*
38+
* Path artifactPath;
39+
* try {
40+
* artifactPath = PathUtils.getNextPath(collectionPath, "artifact", "txt");
41+
* // => C:\git\my-project\test-output\Default suite\artifact-4.txt
42+
* } catch (IOException e) {
43+
* provider.getLogger().info("Unable to get output path; no artifact was captured", e);
44+
* return;
45+
* }
46+
*
47+
* ...
48+
* </pre>
49+
*/
1650
public class PathUtils {
1751

1852
private PathUtils() {

src/main/java/com/nordstrom/common/jdbc/DatabaseUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* sub-configurations or other dynamic data sources (e.g. - web service).</li>
4444
* </ul>
4545
* <b>Query Collection Example</b>
46-
* <p>
46+
* <br><br>
4747
* <pre>
4848
* public class OpctConfig extends {@code SettingsCore<OpctConfig.OpctValues>} {
4949
*
@@ -228,7 +228,7 @@ public static ResultPackage getResultPackage(QueryAPI query, Object... queryArgs
228228

229229
/**
230230
* Execute the specified query with the supplied arguments, returning a result of the indicated type.
231-
* <p>
231+
* <br><br>
232232
* <b>TYPES</b>: Specific result types produce the following behaviors: <ul>
233233
* <li>'null' - The query is executed as an update operation.</li>
234234
* <li>{@link ResultPackage} - An object containing the connection, statement, and result set is returned</li>
@@ -265,7 +265,7 @@ private static Object executeOracleQuery(Class<?> resultType, QueryAPI query, Ob
265265

266266
/**
267267
* Execute the specified query with the supplied arguments, returning a result of the indicated type.
268-
* <p>
268+
* <br><br>
269269
* <b>TYPES</b>: Specific result types produce the following behaviors: <ul>
270270
* <li>'null' - The query is executed as an update operation.</li>
271271
* <li>{@link ResultPackage} - An object containing the connection, statement, and result set is returned</li>

0 commit comments

Comments
 (0)