Package com.sun.interview
Class PropertiesQuestion.StringConstraints
java.lang.Object
com.sun.interview.PropertiesQuestion.ValueConstraints
com.sun.interview.PropertiesQuestion.StringConstraints
- Enclosing class:
PropertiesQuestion
public static class PropertiesQuestion.StringConstraints
extends PropertiesQuestion.ValueConstraints
Value restrictions for string type responses.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected int
The nominal maximum length for the string.protected String[]
Current value set for the suggested response values. -
Constructor Summary
ConstructorsConstructorDescriptionStringConstraints
(int maxLen) Construct with max string length restriction.StringConstraints
(String... suggestions) StringConstraints
(String[] suggestions, int maxLen) Construct with max string length restriction and suggested responses. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the nominal maximum length for the string.String[]
Determine what the current value suggestions are.boolean
Can the user provide whatever string answer they wish, or must they choose only from the suggested values.void
setCustomValuesAllowed
(boolean state) Are user specified values allowed? If not, there must be suggestions present.void
setNominalMaxLength
(int nominalMaxLength) Set the expected maximum length for the string.void
setSuggestions
(String... sugs) Supply some possible values that the user may want to select from.Methods inherited from class com.sun.interview.PropertiesQuestion.ValueConstraints
isReadOnly, isUnsetAllowed, isValid, isVisible, setReadOnly, setUnsetAllowed, setVisible
-
Field Details
-
suggestions
Current value set for the suggested response values.- See Also:
-
custom
protected boolean custom -
nominalMaxLength
protected int nominalMaxLengthThe nominal maximum length for the string.
-
-
Constructor Details
-
StringConstraints
public StringConstraints() -
StringConstraints
-
StringConstraints
public StringConstraints(int maxLen) Construct with max string length restriction.- Parameters:
maxLen
- Maximum length string for the response.
-
StringConstraints
Construct with max string length restriction and suggested responses.- Parameters:
suggestions
- The suggested responses to present the user with. Should be an array of greater than zero length.maxLen
- Maximum length string for the response.
-
-
Method Details
-
getSuggestions
Determine what the current value suggestions are.- Returns:
- Null if there are no suggested values, otherwise an array of length greater than zero.
-
setSuggestions
Supply some possible values that the user may want to select from.- Parameters:
sugs
- The suggested responses to present the user with. Should be an array of greater than zero length. Can be null if you wish to remove the setting completely.- See Also:
-
isCustomValuesAllowed
public boolean isCustomValuesAllowed()Can the user provide whatever string answer they wish, or must they choose only from the suggested values. An assumption is that if this value is false, then there are available suggestions for this value.- See Also:
-
setCustomValuesAllowed
public void setCustomValuesAllowed(boolean state) Are user specified values allowed? If not, there must be suggestions present.- Throws:
IllegalStateException
- If no suggestions have been provided.- See Also:
-
getNominalMaxLength
public int getNominalMaxLength()Get the nominal maximum length for the string.- Returns:
- the nominal maximum length for the string.
- See Also:
-
setNominalMaxLength
public void setNominalMaxLength(int nominalMaxLength) Set the expected maximum length for the string.- Parameters:
nominalMaxLength
- the nominal maximum length for the string.- See Also:
-