Name
ChoiceCallback
Synopsis
A
Callback of this type represents a
request to display set of text choices and allow the user to select
one or more of them. A CallbackHandler, should
display the prompt returned by getPrompt( ) and
also the strings returned by getChoices( ). If
allowMultipleSelections( ) is
true, then it should allow the user to select zero
or more; otherwise, it should only allow the user to select a single
one. In either case, the CallbackHandler should
also call getDefaultChoice( ) and make the choice
at the returned index the default choice. When the user has made her
selection, the CallbackHandler should pass the
index of a single selection to setSelectedIndex(
), or the indexes of multiple selections to
setSelectedIndexes( ).
Figure 19-6. javax.security.auth.callback.ChoiceCallback
public class ChoiceCallback implements Callback, Serializable { // Public Constructors public ChoiceCallback(String prompt, String[ ] choices, int defaultChoice, boolean multipleSelectionsAllowed); // Public Instance Methods public boolean allowMultipleSelections( ); public String[ ] getChoices( ); public int getDefaultChoice( ); public String getPrompt( ); public int[ ] getSelectedIndexes( ); public void setSelectedIndex(int selection); public void setSelectedIndexes(int[ ] selections); }
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access