Package org.jline.reader
Class Candidate
java.lang.Object
org.jline.reader.Candidate
- All Implemented Interfaces:
Comparable<Candidate>
A completion candidate.
- Author:
- Guillaume Nodet
-
Constructor Summary
ConstructorDescriptionSimple constructor with only a single String as an argument.Candidate
(String value, String displ, String group, String descr, String suffix, String key, boolean complete) Constructs a new Candidate.Candidate
(String value, String displ, String group, String descr, String suffix, String key, boolean complete, int sort) Constructs a new Candidate. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
complete()
Boolean indicating whether this candidate is complete or if the completer may further expand the candidate value after this candidate has been selected.descr()
Description of this candidate, usually a small help message to understand the meaning of this candidate.displ()
The string that will be displayed to the user.boolean
group()
The group name for this candidate.int
hashCode()
key()
Candidates which have the same key will be merged together.int
sort()
Integer used to override default sort logic.suffix()
The suffix is added when this candidate is displayed.toString()
value()
The value that will be used for the actual completion.
-
Constructor Details
-
Candidate
Simple constructor with only a single String as an argument.- Parameters:
value
- the candidate
-
Candidate
public Candidate(String value, String displ, String group, String descr, String suffix, String key, boolean complete, int sort) Constructs a new Candidate.- Parameters:
value
- the valuedispl
- the display stringgroup
- the groupdescr
- the descriptionsuffix
- the suffixkey
- the keycomplete
- the complete flagsort
- the sort flag
-
Candidate
public Candidate(String value, String displ, String group, String descr, String suffix, String key, boolean complete) Constructs a new Candidate.- Parameters:
value
- the valuedispl
- the display stringgroup
- the groupdescr
- the descriptionsuffix
- the suffixkey
- the keycomplete
- the complete flag
-
-
Method Details
-
value
The value that will be used for the actual completion. This string should not contain ANSI sequences.- Returns:
- the value
-
displ
The string that will be displayed to the user. This string may contain ANSI sequences.- Returns:
- the display string
-
group
The group name for this candidate. Candidates can be grouped together and this string is used as a key for the group and displayed to the user.- Returns:
- the group
- See Also:
-
descr
Description of this candidate, usually a small help message to understand the meaning of this candidate. This string may contain ANSI sequences.- Returns:
- the description
-
suffix
The suffix is added when this candidate is displayed. However, if the next character entered does not match, the suffix will be automatically removed. This string should not contain ANSI sequences.- Returns:
- the suffix
- See Also:
-
key
Candidates which have the same key will be merged together. For example, if a command has multiple aliases, they can be merged if they are using the same key.- Returns:
- the key
-
complete
public boolean complete()Boolean indicating whether this candidate is complete or if the completer may further expand the candidate value after this candidate has been selected. This can be the case when completing folders for example. If the candidate is complete and is selected, a space separator will be added.- Returns:
- the completion flag
-
sort
public int sort()Integer used to override default sort logic.- Returns:
- the sort int
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Candidate>
-
equals
-
hashCode
public int hashCode() -
toString
-