Class InetAddressValidator
java.lang.Object
org.openstreetmap.josm.data.validation.routines.AbstractValidator
org.openstreetmap.josm.data.validation.routines.InetAddressValidator
InetAddress validation and conversion routines (java.net.InetAddress).
This class provides methods to validate a candidate IP address.
This class is a Singleton; you can retrieve the instance via the getInstance() method.
- Since:
- Validator 1.4
- Version:
- $Revision: 1741724 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final Stringprivate final RegexValidatorIPv4 RegexValidatorprivate static final intprivate static final intprivate static final intprivate static final InetAddressValidatorSingleton instance of this class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InetAddressValidatorReturns the singleton instance of this validator.Returns the name of this validatorbooleanChecks if the specified string is a valid IP address.booleanisValidInet4Address(String inet4Address) Validates an IPv4 address.booleanisValidInet6Address(String inet6Address) Validates an IPv6 address.Methods inherited from class org.openstreetmap.josm.data.validation.routines.AbstractValidator
getErrorMessage, setErrorMessage
-
Field Details
-
IPV4_MAX_OCTET_VALUE
- See Also:
-
MAX_UNSIGNED_SHORT
- See Also:
-
BASE_16
- See Also:
-
IPV4_REGEX
- See Also:
-
IPV6_MAX_HEX_GROUPS
- See Also:
-
IPV6_MAX_HEX_DIGITS_PER_GROUP
- See Also:
-
VALIDATOR
Singleton instance of this class. -
ipv4Validator
IPv4 RegexValidator
-
-
Constructor Details
-
InetAddressValidator
public InetAddressValidator()
-
-
Method Details
-
getInstance
Returns the singleton instance of this validator.- Returns:
- the singleton instance of this validator
-
isValid
Checks if the specified string is a valid IP address.- Specified by:
isValidin classAbstractValidator- Parameters:
inetAddress- the string to validate- Returns:
- true if the string validates as an IP address
-
getValidatorName
Description copied from class:AbstractValidatorReturns the name of this validator- Specified by:
getValidatorNamein classAbstractValidator- Returns:
- the name of this validator
-
isValidInet4Address
Validates an IPv4 address. Returns true if valid.- Parameters:
inet4Address- the IPv4 address to validate- Returns:
- true if the argument contains a valid IPv4 address
-
isValidInet6Address
Validates an IPv6 address. Returns true if valid.- Parameters:
inet6Address- the IPv6 address to validate- Returns:
- true if the argument contains a valid IPv6 address
- Since:
- 1.4.1
-