java.lang.Object
javax.security.auth.callback.ChoiceCallback
- 所有已实现的接口:
-
Serializable,Callback
- 直接已知的子类:
-
RealmChoiceCallback
底层安全服务实例化并将一个ChoiceCallback传递给CallbackHandler的handle方法,以显示选择列表并检索所选的选择。
- 自版本:
- 1.4
- 参见:
-
Constructor Summary
ConstructorsConstructorDescriptionChoiceCallback(String prompt, String[] choices, int defaultChoice, boolean multipleSelectionsAllowed) 构造一个带有提示、选择列表、默认选择和一个布尔值(指定是否允许从选择列表中进行多个选择)的ChoiceCallback。 -
Method Summary
Modifier and TypeMethodDescriptionboolean获取确定是否允许从choices列表中进行多个选择的布尔值。String[]获取选择列表。int获取默认选择。获取提示。int[]获取所选的选择。voidsetSelectedIndex(int selection) 设置所选的选择。voidsetSelectedIndexes(int[] selections) 设置所选的选择。
-
Constructor Details
-
ChoiceCallback
public ChoiceCallback(String prompt, String[] choices, int defaultChoice, boolean multipleSelectionsAllowed) 构造一个带有提示、选择列表、默认选择和一个布尔值(指定是否允许从选择列表中进行多个选择)的ChoiceCallback。- 参数:
-
prompt- 用于描述选择列表的提示。 -
choices- 选择列表。数组会被克隆以防止后续修改。 -
defaultChoice- 在显示选择列表时要用作默认选择的选择。此值表示为choices数组中的索引。 -
multipleSelectionsAllowed- 布尔值,指定是否允许从选择列表中进行多个选择。 - 抛出:
-
IllegalArgumentException- 如果prompt为null,如果prompt长度为0,如果choices为null,如果choices长度为0,如果choices的任何元素为null,如果choices的任何元素长度为0,或者如果defaultChoice不在choices数组边界内。
-
-
Method Details
-
getPrompt
获取提示。- 返回:
- 提示。
-
getChoices
获取选择列表。- 返回:
- 选择列表的副本。
-
getDefaultChoice
public int getDefaultChoice()获取默认选择。- 返回:
-
默认选择,表示为
choices列表中的索引。
-
allowMultipleSelections
public boolean allowMultipleSelections()获取确定是否允许从choices列表中进行多个选择的布尔值。- 返回:
- 是否允许进行多个选择。
-
setSelectedIndex
public void setSelectedIndex(int selection) 设置所选的选择。- 参数:
-
selection- 表示为choices列表中的索引的选择。 - 参见:
-
setSelectedIndexes
public void setSelectedIndexes(int[] selections) 设置所选的选择。- 参数:
-
selections- 表示为choices列表中的索引的选择。数组会被克隆以防止后续修改。 - 抛出:
-
UnsupportedOperationException- 如果不允许进行多个选择,由allowMultipleSelections确定。 - 参见:
-
getSelectedIndexes
public int[] getSelectedIndexes()获取所选的选择。- 返回:
-
所选的选择的副本,表示为
choices列表中的索引。 - 参见:
-