Top Description Fields Constructors Methods
org.apache.commons.text.lookup

pack-priv final Class DnsStringLookup

extends AbstractStringLookup
Class Inheritance
Imports
java.net.InetAddress, .UnknownHostException, org.apache.commons.text.StringSubstitutor

Looks up keys related to DNS entries like host name, canonical host name, host address.

The lookup keys are:

Using a StringLookup from the StringLookupFactory:

StringLookupFactory.INSTANCE.dnsStringLookup().lookup("address|apache.org");

Using a StringSubstitutor:

StringSubstitutor.createInterpolator().replace("... ${dns:address|apache.org} ..."));

The above examples convert "address|apache.org" to "95.216.24.32 (or "40.79.78.1").

Public access is through StringLookupFactory.

Since
1.8
See Also
StringLookupFactory

Field Summary

Modifier and TypeField and Description
pack-priv static final DnsStringLookup
INSTANCE

Defines the singleton for this class.

Inherited from org.apache.commons.text.lookup.AbstractStringLookup:
SPLIT_CHSPLIT_STR

Constructor Summary

AccessConstructor and Description
private
DnsStringLookup()

No need to build instances for now.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The DNS value.
lookup
(final String
the key to be looked up, may be null
key
)

Implements org.apache.commons.text.lookup.StringLookup.lookup.

Looks up the DNS value of the key.

Inherited from org.apache.commons.text.lookup.AbstractStringLookup:
substringAftersubstringAftersubstringAfterLasttoLookupKeytoLookupKey

Field Detail

INSTANCEback to summary
pack-priv static final DnsStringLookup INSTANCE

Defines the singleton for this class.

Constructor Detail

DnsStringLookupback to summary
private DnsStringLookup()

No need to build instances for now.

Method Detail

lookupback to summary
public String lookup(final String key)

Implements org.apache.commons.text.lookup.StringLookup.lookup.

Looks up the DNS value of the key.

Parameters
key:String

the key to be looked up, may be null

Returns:String

The DNS value.

Annotations
@Override