Package sqlline

Class AbstractCommandHandler

java.lang.Object
sqlline.AbstractCommandHandler
All Implemented Interfaces:
CommandHandler
Direct Known Subclasses:
ReflectiveCommandHandler

public abstract class AbstractCommandHandler
extends java.lang.Object
implements CommandHandler
An abstract implementation of CommandHandler.
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractCommandHandler​(SqlLine sqlLine, java.lang.String[] names, java.lang.String helpText, java.util.function.Supplier<java.util.List<org.jline.reader.Completer>> completers)  
    AbstractCommandHandler​(SqlLine sqlLine, java.lang.String[] names, java.lang.String helpText, java.util.List<org.jline.reader.Completer> completers)  
  • Method Summary

    Modifier and Type Method Description
    boolean echoToFile()
    Returns whether the command should be written to the output file of the !script command.
    java.lang.String getHelpText()  
    java.lang.String getName()  
    java.util.List<java.lang.String> getNames()  
    java.util.List<org.jline.reader.Completer> getParameterCompleters()
    Returns the completers that can handle parameters.
    java.lang.String matches​(java.lang.String line)
    Checks to see if the specified string can be dispatched to this command.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface sqlline.CommandHandler

    execute
  • Constructor Details

    • AbstractCommandHandler

      public AbstractCommandHandler​(SqlLine sqlLine, java.lang.String[] names, java.lang.String helpText, java.util.List<org.jline.reader.Completer> completers)
    • AbstractCommandHandler

      public AbstractCommandHandler​(SqlLine sqlLine, java.lang.String[] names, java.lang.String helpText, java.util.function.Supplier<java.util.List<org.jline.reader.Completer>> completers)
  • Method Details

    • getHelpText

      public java.lang.String getHelpText()
      Specified by:
      getHelpText in interface CommandHandler
      Returns:
      the short help description for this command.
    • getName

      public java.lang.String getName()
      Specified by:
      getName in interface CommandHandler
      Returns:
      the name of the command
    • getNames

      public java.util.List<java.lang.String> getNames()
      Specified by:
      getNames in interface CommandHandler
      Returns:
      all the possible names of this command.
    • matches

      public java.lang.String matches​(java.lang.String line)
      Description copied from interface: CommandHandler
      Checks to see if the specified string can be dispatched to this command.
      Specified by:
      matches in interface CommandHandler
      Parameters:
      line - The command line to check
      Returns:
      the command string that matches, or null if it no match
    • getParameterCompleters

      public java.util.List<org.jline.reader.Completer> getParameterCompleters()
      Description copied from interface: CommandHandler
      Returns the completers that can handle parameters.
      Specified by:
      getParameterCompleters in interface CommandHandler
      Returns:
      Completers that can handle parameters
    • echoToFile

      public boolean echoToFile()
      Description copied from interface: CommandHandler
      Returns whether the command should be written to the output file of the !script command.

      Returns true by default, but the !script command hides itself by returning false.

      Specified by:
      echoToFile in interface CommandHandler
      Returns:
      true if command should be written to file