Class PropertiesQuestion.StringConstraints

    • Field Detail

      • custom

        protected boolean custom
      • nominalMaxLength

        protected int nominalMaxLength
        The nominal maximum length for the string.
    • Constructor Detail

      • StringConstraints

        public StringConstraints()
      • StringConstraints

        public StringConstraints​(java.lang.String[] suggestions)
      • StringConstraints

        public StringConstraints​(int maxLen)
        Construct with max string length restriction.
        Parameters:
        maxLen - Maximum length string for the response.
      • StringConstraints

        public StringConstraints​(java.lang.String[] suggestions,
                                 int maxLen)
        Construct with max string length restriction and suggested responses.
        Parameters:
        maxLen - Maximum length string for the response.
        suggestions - The suggested responses to present the user with. Should be an array of greater than zero length.
    • Method Detail

      • setSuggestions

        public void setSuggestions​(java.lang.String[] sugs)
        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(), getSuggestions()
      • getSuggestions

        public java.lang.String[] getSuggestions()
        Determine what the current value suggestions are.
        Returns:
        Null if there are no suggested values, otherwise an array of length greater than zero.
      • setCustomValuesAllowed

        public void setCustomValuesAllowed​(boolean state)
        Are user specified values allowed? If not, there must be suggestions present.
        Throws:
        java.lang.IllegalStateException - If no suggestions have been provided.
        See Also:
        setSuggestions(java.lang.String[])
      • 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(boolean), setSuggestions(java.lang.String[])
      • getNominalMaxLength

        public int getNominalMaxLength()
        Get the nominal maximum length for the string.
        Returns:
        the nominal maximum length for the string.
        See Also:
        setNominalMaxLength(int)
      • 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:
        getNominalMaxLength()