Package com.sun.interview
Class InetAddressQuestion
- java.lang.Object
-
- com.sun.interview.Question
-
- com.sun.interview.InetAddressQuestion
-
-
Field Summary
Fields Modifier and Type Field Description static int
IPv4
A constant to indicate that only IPv4 addresses should be used.static int
IPv6
A constant to indicate that IPv6 addresses should be used.protected java.net.InetAddress
value
The current (default or latest) response to this question.
-
Constructor Summary
Constructors Modifier Constructor Description protected
InetAddressQuestion(Interview interview, java.lang.String tag)
Create a question with a nominated tag.protected
InetAddressQuestion(Interview interview, java.lang.String tag, int type)
Create a question with a nominated tag.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear any response to this question, resetting the value back to its initial state.protected static boolean
equal(java.net.InetAddress i1, java.net.InetAddress i2)
Compare two network address objects for equality.java.net.InetAddress
getDefaultValue()
Get the default response for this question.java.lang.String
getStringValue()
Get the response to this question as a string.int
getStyle()
Get the presentation style (IPv4 or IPv6) for this question.java.net.InetAddress[]
getSuggestions()
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.java.net.InetAddress
getValue()
Get the current (default or latest) response to this question.java.net.InetAddress
getValueOnPath()
Verify this question is on the current path, and if it is, return the current value.boolean
isValueAlwaysValid()
Check if the question always has a valid response.boolean
isValueValid()
Check if the question currently has a valid response.protected void
load(java.util.Map data)
Load the value for this question from a dictionary, using the tag as the key.protected void
save(java.util.Map data)
Save the value for this question in a dictionary, using the tag as the key.void
setDefaultValue(java.net.InetAddress v)
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(java.net.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
setValue(java.lang.String newValue)
Set the current value.void
setValue(java.net.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, reload, removeMarker, setHelpID, setImage, setImage, setSummary, setText
-
-
-
-
Field Detail
-
IPv4
public static final int IPv4
A constant to indicate that only IPv4 addresses should be used.- See Also:
- Constant Field Values
-
IPv6
public static final int IPv6
A constant to indicate that IPv6 addresses should be used. Note that IPv6 includes IPv4 addresses.- See Also:
- Constant Field Values
-
value
protected java.net.InetAddress value
The current (default or latest) response to this question.
-
-
Constructor Detail
-
InetAddressQuestion
protected InetAddressQuestion(Interview interview, java.lang.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, java.lang.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 Detail
-
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(int)
-
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:
getType()
-
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(int)
-
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:
getStyle()
-
getSuggestions
public java.net.InetAddress[] getSuggestions()
Get the suggested responses to this question, or null if none.- Returns:
- The suggestions.
- See Also:
setSuggestions(java.net.InetAddress[])
-
setSuggestions
public void setSuggestions(java.net.InetAddress[] newSuggestions)
Set the set of suggested responses.- Parameters:
newSuggestions
- The values to be set, or null if none- Throws:
java.lang.IllegalArgumentException
- if any except the first of the values in the array are null- See Also:
getSuggestions()
-
getDefaultValue
public java.net.InetAddress getDefaultValue()
Get the default response for this question.- Returns:
- the default response for this question.
- See Also:
setDefaultValue(java.net.InetAddress)
-
setDefaultValue
public void setDefaultValue(java.net.InetAddress v)
Set the default response for this question, used by the clear method.- Parameters:
v
- the default response for this question.- See Also:
getDefaultValue()
-
getValue
public java.net.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(java.net.InetAddress)
-
getValueOnPath
public java.net.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:
getValue()
-
getStringValue
public java.lang.String 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:
Question.setValue(String)
-
setValue
public void setValue(java.net.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:
getValue()
-
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.
-
setValue
public void setValue(java.lang.String newValue) throws Interview.Fault
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:
getValue()
-
clear
public void clear()
Clear any response to this question, resetting the value back to its initial state.
-
load
protected void load(java.util.Map data)
Load the value for this question from a dictionary, using the tag as the key.
-
save
protected void save(java.util.Map data)
Save the value for this question in a dictionary, using the tag as the key.
-
equal
protected static boolean equal(java.net.InetAddress i1, java.net.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.
-
-