Package liquibase.ui
Interface UIService
-
- All Superinterfaces:
Cloneable,ExtensibleObject,Plugin
- All Known Implementing Classes:
CompositeUIService,ConsoleUIService,LoggerUIService,MavenUi
public interface UIService extends ExtensibleObject, Plugin
Service for interacting with the user.
-
-
Field Summary
-
Fields inherited from interface liquibase.plugin.Plugin
PRIORITY_DATABASE, PRIORITY_DEFAULT, PRIORITY_NOT_APPLICABLE, PRIORITY_SPECIALIZED
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleangetAllowPrompt()Return current setting of allow prompt flagintgetPriority()<T> Tprompt(String prompt, T valueIfNoEntry, InputHandler<T> inputHandler, Class<T> type)Prompt the user with the message and wait for a response.
If this UIService implementation does not support user prompts, return the default value.
If inputHandler is null,DefaultInputHandlerwill be used.
If inputHandler throws anIllegalArgumentException, the user will be given the chance to re-enter the value.
If the inputHandler returns true forInputHandler.shouldAllowEmptyInput()and the user enters an empty value when prompted, or hits "enter", the valueIfNoEntry will be returned.voidsendErrorMessage(String message)Send an "error" message to the user.voidsendErrorMessage(String message, Throwable exception)Send an "error" message to the user along with a stacktrace.voidsendMessage(String message)Send a "normal" message to the user.voidsetAllowPrompt(boolean allowPrompt)Method to set flag indicating whether prompting is allowed-
Methods inherited from interface liquibase.ExtensibleObject
clone, describe, get, get, getAttributes, getObjectMetaData, getValuePath, has, set
-
-
-
-
Method Detail
-
getPriority
int getPriority()
-
sendMessage
void sendMessage(String message)
Send a "normal" message to the user.
-
sendErrorMessage
void sendErrorMessage(String message)
Send an "error" message to the user.
-
sendErrorMessage
void sendErrorMessage(String message, Throwable exception)
Send an "error" message to the user along with a stacktrace.
-
prompt
<T> T prompt(String prompt, T valueIfNoEntry, InputHandler<T> inputHandler, Class<T> type)
Prompt the user with the message and wait for a response.
If this UIService implementation does not support user prompts, return the default value.
If inputHandler is null,DefaultInputHandlerwill be used.
If inputHandler throws anIllegalArgumentException, the user will be given the chance to re-enter the value.
If the inputHandler returns true forInputHandler.shouldAllowEmptyInput()and the user enters an empty value when prompted, or hits "enter", the valueIfNoEntry will be returned. If the inputHandler returns false forInputHandler.shouldAllowEmptyInput(), the user will be reprompted until they enter a non-empty value, which will then be returned.
-
setAllowPrompt
void setAllowPrompt(boolean allowPrompt) throws IllegalArgumentExceptionMethod to set flag indicating whether prompting is allowed- Parameters:
allowPrompt- New flag value- Throws:
IllegalArgumentException- If parameter is not allowed
-
getAllowPrompt
boolean getAllowPrompt()
Return current setting of allow prompt flag- Returns:
- boolean
-
-