src/jdk.jshell/share/classes/jdk/jshell/tool/JavaShellToolBuilder.java

Print this page




 169      * @return the {@code JavaShellToolBuilder} instance
 170      */
 171     JavaShellToolBuilder locale(Locale locale);
 172 
 173     /**
 174      * Set to enable a command capturing prompt override.
 175      *
 176      * @implSpec If this method is not called, the behavior should be
 177      * equivalent to calling {@code promptCapture(false)}.
 178      *
 179      * @param capture if {@code true}, basic prompt is the {@code ENQ}
 180      * character and continuation prompt is the {@code ACK} character.
 181      * If false, prompts are as set with set-up or user {@code /set} commands.
 182      * @return the {@code JavaShellToolBuilder} instance
 183      */
 184     JavaShellToolBuilder promptCapture(boolean capture);
 185 
 186     /**
 187      * Run an instance of the Java shell tool as configured by the other methods
 188      * in this interface.  This call is not destructive, more than one call of
 189      * this method may be made from a configured builder.

 190      *
 191      * @param arguments the command-line arguments (including options), if any
 192      * @throws Exception an unexpected fatal exception
 193      */
 194     void run(String... arguments) throws Exception;



















 195 }


 169      * @return the {@code JavaShellToolBuilder} instance
 170      */
 171     JavaShellToolBuilder locale(Locale locale);
 172 
 173     /**
 174      * Set to enable a command capturing prompt override.
 175      *
 176      * @implSpec If this method is not called, the behavior should be
 177      * equivalent to calling {@code promptCapture(false)}.
 178      *
 179      * @param capture if {@code true}, basic prompt is the {@code ENQ}
 180      * character and continuation prompt is the {@code ACK} character.
 181      * If false, prompts are as set with set-up or user {@code /set} commands.
 182      * @return the {@code JavaShellToolBuilder} instance
 183      */
 184     JavaShellToolBuilder promptCapture(boolean capture);
 185 
 186     /**
 187      * Run an instance of the Java shell tool as configured by the other methods
 188      * in this interface.  This call is not destructive, more than one call of
 189      * this method may be made from a configured builder. The  exit code from
 190      * the Java shell tool is ignored.
 191      *
 192      * @param arguments the command-line arguments (including options), if any
 193      * @throws Exception an unexpected fatal exception
 194      */
 195     void run(String... arguments) throws Exception;
 196     
 197     
 198     /**
 199      * Run an instance of the Java shell tool as configured by the other methods
 200      * in this interface.  This call is not destructive, more than one call of
 201      * this method may be made from a configured builder.
 202      * 
 203      * @implSpec The default implementation always returns zero. Implementations
 204      * of this interface should override this method, returning the exit status.
 205      *
 206      * @param arguments the command-line arguments (including options), if any
 207      * @throws Exception an unexpected fatal exception
 208      * @return the exit status with which the tool explicitly exited (if any),
 209      * otherwise 0 for success or 1 for failure
 210      */
 211     default int start(String... arguments) throws Exception {
 212         run(arguments);
 213         return 0;
 214     }
 215 }