- java.lang.Object
-
- org.jline.prompt.impl.AbstractPromptResult<SearchPrompt<T>>
-
- org.jline.prompt.impl.DefaultSearchResult<T>
-
- Type Parameters:
T- the type of items being searched
- All Implemented Interfaces:
PromptResult<SearchPrompt<T>>,SearchResult<T>
public class DefaultSearchResult<T> extends AbstractPromptResult<SearchPrompt<T>> implements SearchResult<T>
Implementation of SearchResult.
-
-
Constructor Summary
Constructors Constructor Description DefaultSearchResult(java.lang.String selectedValue, SearchPrompt<T> prompt)Create a new DefaultSearchResult with the given selected value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDisplayResult()Get a human-readable display representation of the result.protected java.lang.StringgetRawResult()Get the raw (unfiltered) result value.java.lang.StringgetSelectedValue()Get the selected value as a string.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
-
DefaultSearchResult
public DefaultSearchResult(java.lang.String selectedValue, SearchPrompt<T> prompt)Create a new DefaultSearchResult with the given selected value.- Parameters:
selectedValue- the selected value as a stringprompt- the associated SearchPrompt
-
-
Method Detail
-
getSelectedValue
public java.lang.String getSelectedValue()
Description copied from interface:SearchResultGet the selected value as a string.- Specified by:
getSelectedValuein interfaceSearchResult<T>- Returns:
- the selected value
-
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<SearchPrompt<T>>- 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<T>- Returns:
- a display-friendly representation of the result, never
null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-