R
- the return type for all command signature methods, usually a new
command instance or a command fromFile providing methods for
chained invocation of following commandspublic interface CommandInterface<R>
Command
can
be invoked (or instantiated). It consists of the different method signatures
for the command.
Consider for instance the following simplified ls
command. It can be
called without options, with a file, with option flags or both a file and
options. The command interface for ls
would therefore define four
methods:
R ls() R ls(File file) R ls(Ls.Option... options) R ls(File file, Ls.Option... options)Note that all command methods in the interface usually return the generic type
R
. Command factories (see Factory
constant of a specific
command} return a new command instance. Command builders implementing many
different command interfaces return an instance to itself (the BUILDER) to
allow for method chaining, for instance when creating a joined command.
This interface does not define any methods since all methods are defined by
the concrete command. The interface serves as a marker and documentation
interface. Theoretically, a command interface is not required to extend this
interface, but it is highly recommended. Also, if a command factory is used
with GenericCommandBuilder
, it must implement this interface.
Copyright © 2024. All rights reserved.