Class AbstractCommandLineValueGetter<T>

java.lang.Object
liquibase.command.core.init.AbstractCommandLineValueGetter<T>
Type Parameters:
T - the type the user is expected to enter
Direct Known Subclasses:
DirectoryGetter, EnumGetter, FilenameGetter, StringGetter

public abstract class AbstractCommandLineValueGetter<T> extends Object
This class represents the basis for prompts to the user to input values, and should be used as part of the process of obtaining user input for quality checks.
  • Field Details

  • Constructor Details

    • AbstractCommandLineValueGetter

      public AbstractCommandLineValueGetter(Class<T> clazz)
      Create a new value getter.
      Parameters:
      clazz - the type of the value that will be obtained
  • Method Details

    • prompt

      public final T prompt(InitProjectPromptingEnum parameter, Object currentValue) throws Exception
      Prompt the user to enter a value for a parameter, and include the existing value in the prompt.
      Parameters:
      parameter - the parameter to obtain a value for
      newParameterValues - a list of the values that have already been entered by the user during this interactive CLI parameter prompting situation
      Returns:
      the value entered by the user
      Throws:
      Exception
    • validate

      public abstract boolean validate(T input)
      Given the input from the user, after being converted, validate it.
      Returns:
      true if it is valid
    • convert

      public abstract T convert(String input)
      Given the raw input string from the user, convert it to the right type.
      Parameters:
      input - the raw input string from the prompt
      Returns:
      the converted input
    • describe

      public String describe()
      Describe the type of input expected by this class.