javax.security.auth.callback
Class ChoiceCallback

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.security.auth.callback.ChoiceCallback
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Callback sample code for javax.security.auth.callback.Callback definition code for javax.security.auth.callback.Callback
Direct Known Subclasses:
RealmChoiceCallback sample code for javax.security.sasl.RealmChoiceCallback definition code for javax.security.sasl.RealmChoiceCallback

public class ChoiceCallback
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Callback sample code for javax.security.auth.callback.Callback definition code for javax.security.auth.callback.Callback , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

Underlying security services instantiate and pass a ChoiceCallback to the handle method of a CallbackHandler to display a list of choices and to retrieve the selected choice(s).

See Also:
CallbackHandler sample code for javax.security.auth.callback.CallbackHandler definition code for javax.security.auth.callback.CallbackHandler , Serialized Form

Constructor Summary
ChoiceCallback sample code for javax.security.auth.callback.ChoiceCallback.ChoiceCallback(java.lang.String, java.lang.String[], int, boolean) definition code for javax.security.auth.callback.ChoiceCallback.ChoiceCallback(java.lang.String, java.lang.String[], int, boolean) (String sample code for java.lang.String definition code for java.lang.String  prompt, String sample code for java.lang.String definition code for java.lang.String [] choices, int defaultChoice, boolean multipleSelectionsAllowed)
          Construct a ChoiceCallback with a prompt, a list of choices, a default choice, and a boolean specifying whether or not multiple selections from the list of choices are allowed.
 
Method Summary
 boolean allowMultipleSelections sample code for javax.security.auth.callback.ChoiceCallback.allowMultipleSelections() definition code for javax.security.auth.callback.ChoiceCallback.allowMultipleSelections() ()
          Get the boolean determining whether multiple selections from the choices list are allowed.
 String sample code for java.lang.String definition code for java.lang.String [] getChoices sample code for javax.security.auth.callback.ChoiceCallback.getChoices() definition code for javax.security.auth.callback.ChoiceCallback.getChoices() ()
          Get the list of choices.
 int getDefaultChoice sample code for javax.security.auth.callback.ChoiceCallback.getDefaultChoice() definition code for javax.security.auth.callback.ChoiceCallback.getDefaultChoice() ()
          Get the defaultChoice.
 String sample code for java.lang.String definition code for java.lang.String getPrompt sample code for javax.security.auth.callback.ChoiceCallback.getPrompt() definition code for javax.security.auth.callback.ChoiceCallback.getPrompt() ()
          Get the prompt.
 int[] getSelectedIndexes sample code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes() definition code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes() ()
          Get the selected choices.
 void setSelectedIndex sample code for javax.security.auth.callback.ChoiceCallback.setSelectedIndex(int) definition code for javax.security.auth.callback.ChoiceCallback.setSelectedIndex(int) (int selection)
          Set the selected choice.
 void setSelectedIndexes sample code for javax.security.auth.callback.ChoiceCallback.setSelectedIndexes(int[]) definition code for javax.security.auth.callback.ChoiceCallback.setSelectedIndexes(int[]) (int[] selections)
          Set the selected choices.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

ChoiceCallback sample code for javax.security.auth.callback.ChoiceCallback(java.lang.String, java.lang.String[], int, boolean) definition code for javax.security.auth.callback.ChoiceCallback(java.lang.String, java.lang.String[], int, boolean)

public ChoiceCallback(String sample code for java.lang.String definition code for java.lang.String  prompt,
                      String sample code for java.lang.String definition code for java.lang.String [] choices,
                      int defaultChoice,
                      boolean multipleSelectionsAllowed)
Construct a ChoiceCallback with a prompt, a list of choices, a default choice, and a boolean specifying whether or not multiple selections from the list of choices are allowed.

Parameters:
prompt - the prompt used to describe the list of choices.

choices - the list of choices.

defaultChoice - the choice to be used as the default choice when the list of choices are displayed. This value is represented as an index into the choices array.

multipleSelectionsAllowed - boolean specifying whether or not multiple selections can be made from the list of choices.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if prompt is null, if prompt has a length of 0, if choices is null, if choices has a length of 0, if any element from choices is null, if any element from choices has a length of 0 or if defaultChoice does not fall within the array boundaries of choices.
Method Detail

getPrompt sample code for javax.security.auth.callback.ChoiceCallback.getPrompt() definition code for javax.security.auth.callback.ChoiceCallback.getPrompt()

public String sample code for java.lang.String definition code for java.lang.String  getPrompt()
Get the prompt.

Returns:
the prompt.

getChoices sample code for javax.security.auth.callback.ChoiceCallback.getChoices() definition code for javax.security.auth.callback.ChoiceCallback.getChoices()

public String sample code for java.lang.String definition code for java.lang.String [] getChoices()
Get the list of choices.

Returns:
the list of choices.

getDefaultChoice sample code for javax.security.auth.callback.ChoiceCallback.getDefaultChoice() definition code for javax.security.auth.callback.ChoiceCallback.getDefaultChoice()

public int getDefaultChoice()
Get the defaultChoice.

Returns:
the defaultChoice, represented as an index into the choices list.

allowMultipleSelections sample code for javax.security.auth.callback.ChoiceCallback.allowMultipleSelections() definition code for javax.security.auth.callback.ChoiceCallback.allowMultipleSelections()

public boolean allowMultipleSelections()
Get the boolean determining whether multiple selections from the choices list are allowed.

Returns:
whether multiple selections are allowed.

setSelectedIndex sample code for javax.security.auth.callback.ChoiceCallback.setSelectedIndex(int) definition code for javax.security.auth.callback.ChoiceCallback.setSelectedIndex(int)

public void setSelectedIndex(int selection)
Set the selected choice.

Parameters:
selection - the selection represented as an index into the choices list.
See Also:
getSelectedIndexes() sample code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes() definition code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes()

setSelectedIndexes sample code for javax.security.auth.callback.ChoiceCallback.setSelectedIndexes(int[]) definition code for javax.security.auth.callback.ChoiceCallback.setSelectedIndexes(int[])

public void setSelectedIndexes(int[] selections)
Set the selected choices.

Parameters:
selections - the selections represented as indexes into the choices list.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if multiple selections are not allowed, as determined by allowMultipleSelections.
See Also:
getSelectedIndexes() sample code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes() definition code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes()

getSelectedIndexes sample code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes() definition code for javax.security.auth.callback.ChoiceCallback.getSelectedIndexes()

public int[] getSelectedIndexes()
Get the selected choices.

Returns:
the selected choices, represented as indexes into the choices list.
See Also:
setSelectedIndexes(int[]) sample code for javax.security.auth.callback.ChoiceCallback.setSelectedIndexes(int[]) definition code for javax.security.auth.callback.ChoiceCallback.setSelectedIndexes(int[])