Class DnsStringLookup
java.lang.Object
org.apache.commons.text.lookup.AbstractStringLookup
org.apache.commons.text.lookup.DnsStringLookup
- All Implemented Interfaces:
Function<String,String>, UnaryOperator<String>, StringLookup
Looks up keys related to DNS entries like host name, canonical host name, host address.
The lookup keys are:
- name|address: for the host name, for example
"name|93.184.216.34"->"example.com". - canonical-name|address: for the canonical host name, for example
"name|93.184.216.34"->"example.com". - address|hostname: for the host address, for example
"address|example.com"->"93.184.216.34". - address: same as
address|hostname.
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:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final DnsStringLookupDefines the singleton for this class.Fields inherited from class AbstractStringLookup
SPLIT_CH, SPLIT_STR -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKeyMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StringLookup
apply
-
Field Details
-
INSTANCE
Defines the singleton for this class.
-
-
Constructor Details
-
DnsStringLookup
private DnsStringLookup()No need to build instances for now.
-
-
Method Details
-
lookup
-