On Fri, 7 Aug 2020 at 00:59, <[email protected]> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> ggregory pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/commons-io.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
> new 4f02c19 Add getters for simpler subclassing.
> 4f02c19 is described below
>
> commit 4f02c1917881ae88d194568d2a7f23f7329b5f72
> Author: Gary Gregory <[email protected]>
> AuthorDate: Thu Aug 6 19:58:58 2020 -0400
>
> Add getters for simpler subclassing.
> ---
> .../commons/io/file/CopyDirectoryVisitor.java | 34
> ++++++++++++++++++++--
> 1 file changed, 32 insertions(+), 2 deletions(-)
>
> diff --git
> a/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java
> b/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java
> index ff25d31..08b6d97 100644
> --- a/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java
> +++ b/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java
> @@ -48,7 +48,7 @@ public class CopyDirectoryVisitor extends
> CountingPathVisitor {
> * @param copyOptions Specifies how the copying should be done.
> */
> public CopyDirectoryVisitor(final PathCounters pathCounter, final Path
> sourceDirectory, final Path targetDirectory,
> - final CopyOption... copyOptions) {
> + final CopyOption... copyOptions) {
> super(pathCounter);
> this.sourceDirectory = sourceDirectory;
> this.targetDirectory = targetDirectory;
> @@ -67,9 +67,39 @@ public class CopyDirectoryVisitor extends
> CountingPathVisitor {
> Files.copy(sourceFile, targetFile, copyOptions);
> }
>
> + /**
> + * Gets the copy options.
> + *
> + * @return the copy options.
> + * @since 2.8.0
> + */
> + public CopyOption[] getCopyOptions() {
> + return copyOptions;
-1
This allows anyone to modify the array contents.
> + }
> +
> + /**
> + * Gets the source directory.
> + *
> + * @return the source directory.
> + * @since 2.8.0
> + */
> + public Path getSourceDirectory() {
> + return sourceDirectory;
> + }
> +
> + /**
> + * Gets the target directory.
> + *
> + * @return the target directory.
> + * @since 2.8.0
> + */
> + public Path getTargetDirectory() {
> + return targetDirectory;
> + }
> +
> @Override
> public FileVisitResult preVisitDirectory(final Path directory, final
> BasicFileAttributes attributes)
> - throws IOException {
> + throws IOException {
> final Path newTargetDir =
> targetDirectory.resolve(sourceDirectory.relativize(directory));
> if (Files.notExists(newTargetDir)) {
> Files.createDirectory(newTargetDir);
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]