V - concrete type of value objectspublic final class DomainNameMappingBuilder<V>
extends java.lang.Object
DomainNameMapping instances.| Modifier and Type | Class and Description |
|---|---|
private static class |
DomainNameMappingBuilder.ImmutableDomainNameMapping<V>
Immutable mapping from domain name pattern to its associated value object.
|
| Modifier and Type | Field and Description |
|---|---|
private V |
defaultValue |
private java.util.Map<java.lang.String,V> |
map |
| Constructor and Description |
|---|
DomainNameMappingBuilder(int initialCapacity,
V defaultValue)
Constructor with initial capacity of the map holding the mappings
|
DomainNameMappingBuilder(V defaultValue)
Constructor with default initial capacity of the map holding the mappings
|
| Modifier and Type | Method and Description |
|---|---|
DomainNameMappingBuilder<V> |
add(java.lang.String hostname,
V output)
Adds a mapping that maps the specified (optionally wildcard) host name to the specified output value.
|
DomainNameMapping<V> |
build()
Creates a new instance of immutable
DomainNameMapping
Attempts to add new mappings to the result object will cause UnsupportedOperationException to be thrown |
private final V defaultValue
private final java.util.Map<java.lang.String,V> map
public DomainNameMappingBuilder(V defaultValue)
defaultValue - the default value for DomainNameMapping.map(String) to return
when nothing matches the inputpublic DomainNameMappingBuilder(int initialCapacity,
V defaultValue)
initialCapacity - initial capacity for the internal mapdefaultValue - the default value for DomainNameMapping.map(String) to return
when nothing matches the inputpublic DomainNameMappingBuilder<V> add(java.lang.String hostname, V output)
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 DomainNameMapping.map(String)
when the specified host name matches the specified input host namepublic DomainNameMapping<V> build()
DomainNameMapping
Attempts to add new mappings to the result object will cause UnsupportedOperationException to be thrownDomainNameMapping instance