It would make sense to separate the public API from other libraries used internally. This way it's clear to users which API they should be using, and we can minimize breaking changes only to that API.
The following things should be public:
A builder for the DirectoryWatcher that provides all configuration functionality. As part of this we could possibly make DirectoryWatcher an interface, but I'm not sure that's really necessary if we make the constructor private. I don't see a use case for alternative implementations.
DirectoryChangeEvent. This could possibly be an interface to make it easier to restructure the class hierarchy in the future.
The DirectoryChangeListener interface.
The FileHasher interface and some built-in implementations—but not the underlying implementation classes.
A FileHash interface that defines a minimal API for file hashes and utility methods for creating FileHash instances.
The MacOSXListeningWatchService and related classes. We might be able to extract some interfaces to minimize the public API here as well.
The remainder of the classes could either be made package-private or moved to an internal package. I think the latter might be more convenient.
It would make sense to separate the public API from other libraries used internally. This way it's clear to users which API they should be using, and we can minimize breaking changes only to that API.
The following things should be public:
DirectoryWatcher
that provides all configuration functionality. As part of this we could possibly makeDirectoryWatcher
an interface, but I'm not sure that's really necessary if we make the constructor private. I don't see a use case for alternative implementations.DirectoryChangeEvent
. This could possibly be an interface to make it easier to restructure the class hierarchy in the future.DirectoryChangeListener
interface.FileHasher
interface and some built-in implementations—but not the underlying implementation classes.FileHash
interface that defines a minimal API for file hashes and utility methods for creatingFileHash
instances.MacOSXListeningWatchService
and related classes. We might be able to extract some interfaces to minimize the public API here as well.The remainder of the classes could either be made package-private or moved to an
internal
package. I think the latter might be more convenient.