Skip to content

Commit a46b759

Browse files
committed
Internal refactoring
1 parent 9db6ef0 commit a46b759

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ private Builder() {
142142
// empty
143143
}
144144

145+
private File checkOriginFile() {
146+
return checkOrigin().getFile();
147+
}
148+
145149
/**
146150
* Gets a new {@link FileAlterationObserver} instance.
147151
*
@@ -150,7 +154,7 @@ private Builder() {
150154
*/
151155
@Override
152156
public FileAlterationObserver get() throws IOException {
153-
return new FileAlterationObserver(rootEntry != null ? rootEntry : new FileEntry(checkOrigin().getFile()), fileFilter, toComparator(ioCase));
157+
return new FileAlterationObserver(this);
154158
}
155159

156160
/**
@@ -231,6 +235,10 @@ private static Comparator<File> toComparator(final IOCase ioCase) {
231235
*/
232236
private final Comparator<File> comparator;
233237

238+
private FileAlterationObserver(final Builder builder) {
239+
this(builder.rootEntry != null ? builder.rootEntry : new FileEntry(builder.checkOriginFile()), builder.fileFilter, toComparator(builder.ioCase));
240+
}
241+
234242
/**
235243
* Constructs an observer for the specified directory.
236244
*

0 commit comments

Comments
 (0)