V - concrete type of value objectsprivate static final class DomainNameMappingBuilder.ImmutableDomainNameMapping<V> extends DomainNameMapping<V>
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String[] |
domainNamePatterns |
private java.util.Map<java.lang.String,V> |
map |
private static int |
REPR_CONST_PART_LENGTH |
private static java.lang.String |
REPR_HEADER |
private static java.lang.String |
REPR_MAP_CLOSING |
private static java.lang.String |
REPR_MAP_OPENING |
private V[] |
values |
defaultValue| Modifier | Constructor and Description |
|---|---|
private |
ImmutableDomainNameMapping(V defaultValue,
java.util.Map<java.lang.String,V> map) |
| Modifier and Type | Method and Description |
|---|---|
DomainNameMapping<V> |
add(java.lang.String hostname,
V output)
Deprecated.
|
private java.lang.StringBuilder |
appendMapping(java.lang.StringBuilder sb,
int mappingIndex) |
private static java.lang.StringBuilder |
appendMapping(java.lang.StringBuilder sb,
java.lang.String domainNamePattern,
java.lang.String value) |
java.util.Map<java.lang.String,V> |
asMap()
Returns a read-only
Map of the domain mapping patterns and their associated value objects. |
private static int |
estimateBufferSize(int defaultValueLength,
int numberOfMappings,
int estimatedMappingLength)
Estimates the length of string representation of the given instance:
est = lengthOfConstantComponents + defaultValueLength + (estimatedMappingLength * numOfMappings) * 1.10
|
V |
map(java.lang.String hostname)
Returns mapped value of the specified input.
|
java.lang.String |
toString() |
matches, normalizeHostnameprivate static final java.lang.String REPR_HEADER
private static final java.lang.String REPR_MAP_OPENING
private static final java.lang.String REPR_MAP_CLOSING
private static final int REPR_CONST_PART_LENGTH
private final java.lang.String[] domainNamePatterns
private final V[] values
private final java.util.Map<java.lang.String,V> map
@Deprecated public DomainNameMapping<V> add(java.lang.String hostname, V output)
DomainNameMapping
DNS wildcard is supported as hostname.
For example, you can use *.netty.io to match netty.io and downloads.netty.io.
add in class DomainNameMapping<V>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 V map(java.lang.String hostname)
Mappingpublic java.util.Map<java.lang.String,V> asMap()
DomainNameMappingMap of the domain mapping patterns and their associated value objects.asMap in class DomainNameMapping<V>public java.lang.String toString()
toString in class DomainNameMapping<V>private static int estimateBufferSize(int defaultValueLength,
int numberOfMappings,
int estimatedMappingLength)
defaultValueLength - length of string representation of DomainNameMappingBuilder.defaultValuenumberOfMappings - number of mappings the given instance holds,
e.g. #domainNamePatterns#lengthestimatedMappingLength - estimated size taken by one mappingtoString()private java.lang.StringBuilder appendMapping(java.lang.StringBuilder sb,
int mappingIndex)
private static java.lang.StringBuilder appendMapping(java.lang.StringBuilder sb,
java.lang.String domainNamePattern,
java.lang.String value)