public class DomainNameMapping<V> extends java.lang.Object implements Mapping<java.lang.String,V>
DNS wildcard is supported as hostname, so you can use *.netty.io
to match both netty.io
and downloads.netty.io
.
Modifier and Type | Field and Description |
---|---|
(package private) V |
defaultValue |
private java.util.Map<java.lang.String,V> |
map |
private java.util.Map<java.lang.String,V> |
unmodifiableMap |
Constructor and Description |
---|
DomainNameMapping(int initialCapacity,
V defaultValue)
Deprecated.
use
DomainNameMappingBuilder to create and fill the mapping instead |
DomainNameMapping(java.util.Map<java.lang.String,V> map,
V defaultValue) |
DomainNameMapping(V defaultValue)
Deprecated.
use
DomainNameMappingBuilder to create and fill the mapping instead |
Modifier and Type | Method and Description |
---|---|
DomainNameMapping<V> |
add(java.lang.String hostname,
V output)
Deprecated.
use
DomainNameMappingBuilder to create and fill the mapping instead |
java.util.Map<java.lang.String,V> |
asMap()
Returns a read-only
Map of the domain mapping patterns and their associated value objects. |
V |
map(java.lang.String hostname)
Returns mapped value of the specified input.
|
(package private) static boolean |
matches(java.lang.String template,
java.lang.String hostName)
Simple function to match DNS wildcard.
|
private static boolean |
needsNormalization(java.lang.String hostname) |
(package private) static java.lang.String |
normalizeHostname(java.lang.String hostname)
IDNA ASCII conversion and case normalization
|
java.lang.String |
toString() |
final V defaultValue
private final java.util.Map<java.lang.String,V> map
private final java.util.Map<java.lang.String,V> unmodifiableMap
@Deprecated public DomainNameMapping(V defaultValue)
DomainNameMappingBuilder
to create and fill the mapping insteaddefaultValue
- the default value for map(String)
to return when nothing matches the input@Deprecated public DomainNameMapping(int initialCapacity, V defaultValue)
DomainNameMappingBuilder
to create and fill the mapping insteadinitialCapacity
- initial capacity for the internal mapdefaultValue
- the default value for map(String)
to return when nothing matches the input@Deprecated public DomainNameMapping<V> add(java.lang.String hostname, V output)
DomainNameMappingBuilder
to create and fill the mapping instead
DNS wildcard is supported as hostname.
For example, you can use *.netty.io
to match netty.io
and downloads.netty.io
.
hostname
- the host name (optionally wildcard)output
- the output value that will be returned by map(String)
when the specified host name
matches the specified input host namestatic boolean matches(java.lang.String template, java.lang.String hostName)
static java.lang.String normalizeHostname(java.lang.String hostname)
private static boolean needsNormalization(java.lang.String hostname)
public V map(java.lang.String hostname)
Mapping
public java.util.Map<java.lang.String,V> asMap()
Map
of the domain mapping patterns and their associated value objects.public java.lang.String toString()
toString
in class java.lang.Object