Class InetAddressQuestion

java.lang.Object
com.sun.interview.Question
com.sun.interview.InetAddressQuestion

public abstract class InetAddressQuestion extends Question
A question to which the response is an IP address. Both IPv4 and IPv6 addresses are supported.
  • Field Details

    • IPv4

      public static final int IPv4
      A constant to indicate that only IPv4 addresses should be used.
      See Also:
    • IPv6

      public static final int IPv6
      A constant to indicate that IPv6 addresses should be used. Note that IPv6 includes IPv4 addresses.
      See Also:
    • value

      protected InetAddress value
      The current (default or latest) response to this question.
  • Constructor Details

    • InetAddressQuestion

      protected InetAddressQuestion(Interview interview, String tag)
      Create a question with a nominated tag.
      Parameters:
      interview - The interview containing this question.
      tag - A unique tag to identify this specific question.
    • InetAddressQuestion

      protected InetAddressQuestion(Interview interview, String tag, int type)
      Create a question with a nominated tag.
      Parameters:
      interview - The interview containing this question.
      tag - A unique tag to identify this specific question.
      type - A value to (IPv4 or IPv6) to indicate the type of address used by the question.
  • Method Details

    • equal

      protected static boolean equal(InetAddress i1, InetAddress i2)
      Compare two network address objects for equality.
      Parameters:
      i1 - The first address to be compared, or null.
      i2 - The other address to be compared, or null.
      Returns:
      true if both arguments are null, or if both represent the same network address.
    • getType

      public int getType()
      Get the type of addresses (IPv4 or IPv6) that will be accepted by this question.
      Returns:
      the type of address that will be accepted by this question
      See Also:
    • setType

      protected void setType(int type)
      Set the type of addresses (IPv4 or IPv6) that should be accepted by this question.
      Parameters:
      type - the type of address that should be accepted by this question
      See Also:
    • getStyle

      public int getStyle()
      Get the presentation style (IPv4 or IPv6) for this question. This is only a hint. Setting the type to IPv6 or setting suggestions may cause the actual presentation style to be IPv6. In IPv4 style, the data entry is four dotted decimal fields. In IPv6 style, the data entry is a single type in field, with an associated lookup button.
      Returns:
      the presentation style for this question
      See Also:
    • setStyle

      protected void setStyle(int style)
      Set the presentation style (IPv4 or IPv6) for this question. In IPv4 style, the data entry is four dotted decimal fields. In IPv6 style, the data entry is a single type in field, with an associated lookup button.
      Parameters:
      style - the presentation style for this question
      See Also:
    • getSuggestions

      public InetAddress[] getSuggestions()
      Get the suggested responses to this question, or null if none.
      Returns:
      The suggestions.
      See Also:
    • setSuggestions

      public void setSuggestions(InetAddress... newSuggestions)
      Set the set of suggested responses.
      Parameters:
      newSuggestions - The values to be set, or null if none
      Throws:
      IllegalArgumentException - if any except the first of the values in the array are null
      See Also:
    • getDefaultValue

      public InetAddress getDefaultValue()
      Get the default response for this question.
      Returns:
      the default response for this question.
      See Also:
    • setDefaultValue

      public void setDefaultValue(InetAddress v)
      Set the default response for this question, used by the clear method.
      Parameters:
      v - the default response for this question.
      See Also:
    • getValue

      public InetAddress getValue()
      Get the current (default or latest) response to this question. If the question type is set to IPv4, a valid response will be an Inet4Address; otherwise, if the question type is set to IPv6, a valid response will be an Inet4Address or an Inet6Address
      Returns:
      The current value.
      See Also:
    • setValue

      public void setValue(InetAddress newValue)
      Set the current value. Although any value can be set, if the value is to be considered valid it must be an Inet4Address if the question type is set to IPv4, or either an Inet4Address or an Inet6Address if the question type is set to IPv6.
      Parameters:
      newValue - The value to be set.
      See Also:
    • setValue

      public void setValue(String newValue) throws Interview.Fault
      Set the current value.
      Specified by:
      setValue in class Question
      Parameters:
      newValue - The value to be set.
      Throws:
      Interview.Fault - retained for compatibility; should not be thrown
      See Also:
    • getValueOnPath

      public InetAddress getValueOnPath() throws Interview.NotOnPathFault
      Verify this question is on the current path, and if it is, return the current value.
      Returns:
      the current value of this question
      Throws:
      Interview.NotOnPathFault - if this question is not on the current path
      See Also:
    • getStringValue

      public String getStringValue()
      Description copied from class: Question
      Get the response to this question as a string.
      Specified by:
      getStringValue in class Question
      Returns:
      a string representing the current response to this question, or null.
      See Also:
    • isValueValid

      public boolean isValueValid()
      Description copied from class: Question
      Check if the question currently has a valid response.
      Specified by:
      isValueValid in class Question
      Returns:
      true if the question currently has a valid response, and false otherwise.
    • isValueAlwaysValid

      public boolean isValueAlwaysValid()
      Description copied from class: Question
      Check if the question always has a valid response. This may be true, for example, for a choice question with a default response.
      Specified by:
      isValueAlwaysValid in class Question
      Returns:
      true if the question always has a valid response, and false otherwise.
    • clear

      public void clear()
      Clear any response to this question, resetting the value back to its initial state.
      Specified by:
      clear in class Question
    • save

      protected void save(Map<String,String> data)
      Save the value for this question in a dictionary, using the tag as the key.
      Specified by:
      save in class Question
      Parameters:
      data - The map in which to save the value for this question.