Package com.sun.interview
Class InetAddressQuestion
java.lang.Object
com.sun.interview.Question
com.sun.interview.InetAddressQuestion
A
question
to which the response is an IP address.
Both IPv4 and IPv6 addresses are supported.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
A constant to indicate that only IPv4 addresses should be used.static final int
A constant to indicate that IPv6 addresses should be used.protected InetAddress
The current (default or latest) response to this question. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
InetAddressQuestion
(Interview interview, String tag) Create a question with a nominated tag.protected
InetAddressQuestion
(Interview interview, String tag, int type) Create a question with a nominated tag. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear any response to this question, resetting the value back to its initial state.protected static boolean
equal
(InetAddress i1, InetAddress i2) Compare two network address objects for equality.Get the default response for this question.Get the response to this question as a string.int
getStyle()
Get the presentation style (IPv4 or IPv6) for this question.Get the suggested responses to this question, or null if none.int
getType()
Get the type of addresses (IPv4 or IPv6) that will be accepted by this question.getValue()
Get the current (default or latest) response to this question.Verify this question is on the current path, and if it is, return the current value.boolean
Check if the question always has a valid response.boolean
Check if the question currently has a valid response.protected void
Save the value for this question in a dictionary, using the tag as the key.void
Set the default response for this question, used by the clear method.protected void
setStyle
(int style) Set the presentation style (IPv4 or IPv6) for this question.void
setSuggestions
(InetAddress... newSuggestions) Set the set of suggested responses.protected void
setType
(int type) Set the type of addresses (IPv4 or IPv6) that should be accepted by this question.void
Set the current value.void
setValue
(InetAddress newValue) Set the current value.Methods inherited from class com.sun.interview.Question
addMarker, equals, export, getChecklistItems, getHelpID, getImage, getInterview, getKey, getNext, getResourceString, getResourceString, getSummary, getTag, getText, getTextArgs, hashCode, hasMarker, isEnabled, isHidden, load, reload, removeMarker, setHelpID, setImage, setImage, setSummary, setText
-
Field Details
-
IPv4
public static final int IPv4A constant to indicate that only IPv4 addresses should be used.- See Also:
-
IPv6
public static final int IPv6A constant to indicate that IPv6 addresses should be used. Note that IPv6 includes IPv4 addresses.- See Also:
-
value
The current (default or latest) response to this question.
-
-
Constructor Details
-
InetAddressQuestion
Create a question with a nominated tag.- Parameters:
interview
- The interview containing this question.tag
- A unique tag to identify this specific question.
-
InetAddressQuestion
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
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
Get the suggested responses to this question, or null if none.- Returns:
- The suggestions.
- See Also:
-
setSuggestions
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
Get the default response for this question.- Returns:
- the default response for this question.
- See Also:
-
setDefaultValue
Set the default response for this question, used by the clear method.- Parameters:
v
- the default response for this question.- See Also:
-
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
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
Set the current value.- Specified by:
setValue
in classQuestion
- Parameters:
newValue
- The value to be set.- Throws:
Interview.Fault
- retained for compatibility; should not be thrown- See Also:
-
getValueOnPath
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
Description copied from class:Question
Get the response to this question as a string.- Specified by:
getStringValue
in classQuestion
- 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 classQuestion
- 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 classQuestion
- 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. -
save
Save the value for this question in a dictionary, using the tag as the key.
-