I'm confused about the design of JDK7 nio package (which I use often). Take for example Files.copy
, which takes instances of CopyOption
's which is an empty interface, e.g. implemented by StandardCopyOption
:
public enum StandardCopyOption implements CopyOption {
REPLACE_EXISTING
COPY_ATTRIBUTES,
ATOMIC_MOVE;
}
public interface CopyOption {
}
What is the idea behind such a design? I mean, even though the CopyOption
interfaces is passed to Files.copy
, Files.copy
has still a compile-time dependency on StandardCopyOption
(see source-code of Files.copy
).
Aucun commentaire:
Enregistrer un commentaire