@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class DNSHostNameArgumentValueValidator extends ArgumentValueValidator implements java.io.Serializable
Constructor and Description |
---|
DNSHostNameArgumentValueValidator()
Creates a new DNS host name argument value validator with the default
settings.
|
DNSHostNameArgumentValueValidator(boolean allowIPAddresses,
boolean allowUnqualifiedNames,
boolean allowUnresolvableNames,
NameResolver nameResolver)
Creates a new DNS host name argument value validator with the provided
settings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allowIPAddresses()
Indicates whether this validator will allow values that represent valid
numeric IP addresses rather than DNS host names.
|
boolean |
allowUnqualifiedNames()
Indicates whether this validator will allow unqualified DNS host names
(that is, host names that do not include a domain component).
|
boolean |
allowUnresolvableNames()
Indicates whether this validator will allow DNS host names that cannot be
resolved to IP addresses.
|
NameResolver |
getNameResolver()
Retrieves the name resolver that will be used when attempting to resolve
host names to IP addresses.
|
java.lang.String |
toString()
Retrieves a string representation of this argument value validator.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this argument value validator to the
provided buffer.
|
void |
validateArgumentValue(Argument argument,
java.lang.String valueString)
Examines the value(s) assigned to the provided argument to determine
whether they are acceptable.
|
static void |
validateDNSHostName(java.lang.String name)
Ensures that the provided name represents a valid DNS host name using the
default settings.
|
static void |
validateDNSHostName(java.lang.String name,
boolean allowIPAddresses,
boolean allowUnqualifiedNames,
boolean allowUnresolvableNames,
NameResolver nameResolver)
Ensures that the provided name represents a valid DNS host name using the
provided settings.
|
public DNSHostNameArgumentValueValidator()
public DNSHostNameArgumentValueValidator(boolean allowIPAddresses, boolean allowUnqualifiedNames, boolean allowUnresolvableNames, @Nullable NameResolver nameResolver)
allowIPAddresses
- Indicates whether this validator will allow
values that represent numeric IP addresses
rather than DNS host names. If this is
true
, then valid IP addresses will
be accepted as well as valid DNS host
names. If this is false
, then only
valid DNS host names will be accepted.allowUnqualifiedNames
- Indicates whether this validator will allow
values that represent unqualified host
names. If this is true
, then
unqualified names will be accepted as long
as they are otherwise acceptable. If this
is false
, then only fully qualified
host names will be accepted.allowUnresolvableNames
- Indicates whether this validator will allow
host name values that do not resolve to
IP addresses. If this is true
,
then this validator will not attempt to
resolve host names. If this is
false
, then this validator will
reject any host name that cannot be
resolved to an IP address.nameResolver
- The name resolver that will be used when
attempting to resolve host names to IP
addresses. If this is null
, then
the LDAP SDK's default name resolver will
be used.public boolean allowIPAddresses()
true
if this validator will accept values that represent
either valid numeric IP addresses or numeric DNS host names, or
false
if it will reject values that represent numeric
IP addresses.public boolean allowUnqualifiedNames()
true
if this validator will allow both unqualified and
fully qualified host names, or false
if it will only
accept fully qualified host names.public boolean allowUnresolvableNames()
true
if this validator will only validate the syntax for
DNS host names and will not make any attempt to resolve them to
IP addresses, or false
if it will attempt to resolve host
names to IP addresses and will reject any names that cannot be
resolved.@NotNull public NameResolver getNameResolver()
public void validateArgumentValue(@NotNull Argument argument, @NotNull java.lang.String valueString) throws ArgumentException
validateArgumentValue
in class ArgumentValueValidator
argument
- The argument to which the value is being provided.valueString
- The string representation of the value to be
validated. This value will have already passed any
normal validation performed by the argument.ArgumentException
- If the provided value is determined to be
unacceptable.public static void validateDNSHostName(@NotNull java.lang.String name) throws ArgumentException
name
- The name to validate as a DNS host name. It must not be
null
or empty.ArgumentException
- If the provided name is not considered valid.public static void validateDNSHostName(@Nullable java.lang.String name, boolean allowIPAddresses, boolean allowUnqualifiedNames, boolean allowUnresolvableNames, @Nullable NameResolver nameResolver) throws ArgumentException
name
- The name to validate as a DNS host name.allowIPAddresses
- Indicates whether this validator will allow
values that represent numeric IP addresses
rather than DNS host names. If this is
true
, then valid IP addresses will
be accepted as well as valid DNS host
names. If this is false
, then only
valid DNS host names will be accepted.allowUnqualifiedNames
- Indicates whether this validator will allow
values that represent unqualified host
names. If this is true
, then
unqualified names will be accepted as long
as they are otherwise acceptable. If this
is false
, then only fully qualified
host names will be accepted.allowUnresolvableNames
- Indicates whether this validator will allow
host name values that do not resolve to
IP addresses. If this is true
,
then this validator will not attempt to
resolve host names. If this is
false
, then this validator will
reject any host name that cannot be
resolved to an IP address.nameResolver
- The name resolver that will be used when
attempting to resolve host names to IP
addresses. If this is null
, then
the LDAP SDK's default name resolver will
be used.ArgumentException
- If the provided name is not considered valid.@NotNull public java.lang.String toString()
toString
in class java.lang.Object