001package org.unix4j.codegen.annotation;
002
003
004public enum InputMode {
005        /**
006         * The command processes no input at all. There is no obligation for the
007         * command to read the input.
008         * <p>
009         * Commands of this type are suitable starting points for command execution.
010         * A static method is generated in {@code Unix4j} if a command interface
011         * method is annotated with this mode.
012         */
013        NoInput,
014        /**
015         * The command processes its input line by line. It is, however, a
016         * contractual obligation for the command to read the complete input passed
017         * to the execute method.
018         * <p>
019         * The command can process the input line-by-line and write to the output
020         * when processing a single line, but it is a requirement that all available
021         * input lines have been read when returning from the command's execute
022         * method.
023         */
024        LineByLine,
025        /**
026         * The command processes its input as a whole. It is at the same time a
027         * contractual obligation for the command to read the complete input passed
028         * to the command's execute method.
029         */
030        CompleteInput;
031
032        /**
033         * Convenience method returning true if this constant equals
034         * {@link #NoInput}.
035         * 
036         * @return true if {@code this==NoInput}
037         */
038        public boolean isNoInput() {
039                return NoInput.equals(this);
040        }
041
042        /**
043         * Convenience method returning true if this constant equals
044         * {@link #LineByLine}.
045         * 
046         * @return true if {@code this==LineByLine}
047         */
048        public boolean isLineByLine() {
049                return LineByLine.equals(this);
050        }
051
052        /**
053         * Convenience method returning true if this constant equals
054         * {@link #CompleteInput}.
055         * 
056         * @return true if {@code this==CompleteInput}
057         */
058        public boolean isCompleteInput() {
059                return CompleteInput.equals(this);
060        }
061
062}