|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.InputVerifier com.gridsystems.config.tools.TextVerifier com.gridsystems.config.tools.IpVerifier
public class IpVerifier
Verifies that the String has a valid IP format. Verifies that the String is a valid IP number. It just checks that the String is formed by 4 or 6 groups of digits separed by dot, each group ranging from 0 to 255.
Field Summary | |
---|---|
static java.lang.String |
ID_ERROR
Errors detected by this verifier. |
static int |
IP_4
IP version 4 address type. |
static int |
IP_4_IP_6
IP versions 4 and 6 type. |
static int |
IP_6
IP version 6 address type. |
Fields inherited from class com.gridsystems.config.tools.TextVerifier |
---|
support |
Constructor Summary | |
---|---|
IpVerifier(ErrorSupport support,
java.lang.String id)
Creates an instance that matches IPs with both 4 and 6 numeric fields. |
|
IpVerifier(ErrorSupport support,
java.lang.String id,
int validIp)
Creates an instance. |
Method Summary | |
---|---|
void |
cleanErrors()
Removes from the error support manager the list of errors of this verifier. |
static boolean |
isLoopbackAddress(java.lang.String ip,
int ipVersion)
Tells if an IP is a loopback address. |
void |
setEmptyAllowed(boolean value)
Sets the "Empty allowed" flag. |
void |
setErrorLoopbackId(java.lang.String errorLoopbackId)
Sets the error shown if the validation fails due to the loopback address check. |
void |
setLoopbackAddressAllowed(boolean allowLoopbackAddress)
Sets the "Loopback Address allowed" flag. |
boolean |
verify(java.lang.String text)
Validates a text string. |
Methods inherited from class com.gridsystems.config.tools.TextVerifier |
---|
updateError, verify |
Methods inherited from class javax.swing.InputVerifier |
---|
shouldYieldFocus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ID_ERROR
public static final int IP_4
public static final int IP_6
public static final int IP_4_IP_6
Constructor Detail |
---|
public IpVerifier(ErrorSupport support, java.lang.String id)
support
- The error support instanceid
- The error identifier for the event of an invalid IP.public IpVerifier(ErrorSupport support, java.lang.String id, int validIp)
support
- The error support instance.id
- The error identifier for the event of an invalid IP.validIp
- an int that tells if the verifier must accept only IPs with
four numeric fields (IP_4
), only IPs with 6 numeric
fields (IP_6
) or both types (IP_4_IP_6
).
If the parameter is not any of these values, it default to
IP_4_IP_6
.Method Detail |
---|
public void setEmptyAllowed(boolean value)
value
- The flag valuepublic void setLoopbackAddressAllowed(boolean allowLoopbackAddress)
allowLoopbackAddress
- The flag value. Loopback addresses will be
allowed only and only if this value is set to true.setErrorLoopbackId(String)
public void setErrorLoopbackId(java.lang.String errorLoopbackId)
errorLoopbackId
- the id of the error to show.public boolean verify(java.lang.String text)
verify
in class TextVerifier
text
- The string to validate
public void cleanErrors()
TextVerifier
This method will be used on field deactivation.
cleanErrors
in class TextVerifier
TextVerifier.cleanErrors()
public static boolean isLoopbackAddress(java.lang.String ip, int ipVersion)
ip
- the IP to check. It must be a valid IP.ipVersion
- the version of the IP. If it is an invalid value, it will
return false.
ip
is a valid IPv4 or IPv6
address and it is a loopback address.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |