- java.lang.Object
-
- org.jline.prompt.impl.AbstractPromptResult<ConfirmPrompt>
-
- org.jline.prompt.impl.DefaultConfirmResult
-
- All Implemented Interfaces:
ConfirmResult,PromptResult<ConfirmPrompt>
public class DefaultConfirmResult extends AbstractPromptResult<ConfirmPrompt> implements ConfirmResult
Implementation of ConfirmResult.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jline.prompt.ConfirmResult
ConfirmResult.ConfirmationValue
-
-
Constructor Summary
Constructors Constructor Description DefaultConfirmResult(ConfirmResult.ConfirmationValue confirmed, ConfirmPrompt prompt)Create a new DefaultConfirmResult with the given confirmation value and item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfirmResult.ConfirmationValuegetConfirmed()Get the confirmation value.java.lang.StringgetDisplayResult()Get a human-readable display representation of the result.protected java.lang.StringgetRawResult()Get the raw (unfiltered) result value.booleanisConfirmed()Check if the user confirmed (answered YES).java.lang.StringtoString()-
Methods inherited from class org.jline.prompt.impl.AbstractPromptResult
applyFilter, getPrompt, getResult
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jline.prompt.PromptResult
getPrompt, getResult
-
-
-
-
Constructor Detail
-
DefaultConfirmResult
public DefaultConfirmResult(ConfirmResult.ConfirmationValue confirmed, ConfirmPrompt prompt)
Create a new DefaultConfirmResult with the given confirmation value and item.- Parameters:
confirmed- the confirmation valueitem- the associated PromptItem, or null if none
-
-
Method Detail
-
getConfirmed
public ConfirmResult.ConfirmationValue getConfirmed()
Description copied from interface:ConfirmResultGet the confirmation value.- Specified by:
getConfirmedin interfaceConfirmResult- Returns:
- the confirmation value
-
isConfirmed
public boolean isConfirmed()
Description copied from interface:ConfirmResultCheck if the user confirmed (answered YES).- Specified by:
isConfirmedin interfaceConfirmResult- Returns:
- true if the user confirmed, false otherwise
-
getRawResult
protected java.lang.String getRawResult()
Description copied from class:AbstractPromptResultGet the raw (unfiltered) result value. Subclasses must implement this instead ofAbstractPromptResult.getResult().- Specified by:
getRawResultin classAbstractPromptResult<ConfirmPrompt>- Returns:
- the raw result value
-
getDisplayResult
public java.lang.String getDisplayResult()
Description copied from interface:PromptResultGet a human-readable display representation of the result.This method returns a formatted version of the result that is suitable for display to users. It may differ from
PromptResult.getResult()by providing more descriptive text or better formatting.The default implementation returns the same value as
PromptResult.getResult(). Specific result types may override this to provide more user-friendly formatting.- Specified by:
getDisplayResultin interfacePromptResult<ConfirmPrompt>- Returns:
- a display-friendly representation of the result, never
null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-