Class DomainNameMappingBuilder.ImmutableDomainNameMapping<V>
java.lang.Object
io.netty.util.DomainNameMapping<V>
io.netty.util.DomainNameMappingBuilder.ImmutableDomainNameMapping<V>
- Type Parameters:
V- concrete type of value objects
- Enclosing class:
DomainNameMappingBuilder<V>
private static final class DomainNameMappingBuilder.ImmutableDomainNameMapping<V>
extends DomainNameMapping<V>
Immutable mapping from domain name pattern to its associated value object.
Mapping is represented by two arrays: keys and values. Key domainNamePatterns[i] is associated with values[i].
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]private static final intprivate static final Stringprivate static final Stringprivate static final Stringprivate final V[]Fields inherited from class DomainNameMapping
defaultValue -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableDomainNameMapping(V defaultValue, Map<String, V> map) -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.private StringBuilderappendMapping(StringBuilder sb, int mappingIndex) private static StringBuilderappendMapping(StringBuilder sb, String domainNamePattern, String value) asMap()Returns a read-onlyMapof the domain mapping patterns and their associated value objects.private static intestimateBufferSize(int defaultValueLength, int numberOfMappings, int estimatedMappingLength) Estimates the length of string representation of the given instance: est = lengthOfConstantComponents + defaultValueLength + (estimatedMappingLength * numOfMappings) * 1.10Returns mapped value of the specified input.toString()Methods inherited from class DomainNameMapping
matches, normalizeHostname
-
Field Details
-
REPR_HEADER
- See Also:
-
REPR_MAP_OPENING
- See Also:
-
REPR_MAP_CLOSING
- See Also:
-
REPR_CONST_PART_LENGTH
private static final int REPR_CONST_PART_LENGTH -
domainNamePatterns
-
values
-
map
-
-
Constructor Details
-
ImmutableDomainNameMapping
-
-
Method Details
-
add
Deprecated.Description copied from class:DomainNameMappingAdds a mapping that maps the specified (optionally wildcard) host name to the specified output value.DNS wildcard is supported as hostname. For example, you can use
*.netty.ioto matchnetty.ioanddownloads.netty.io.- Overrides:
addin classDomainNameMapping<V>- Parameters:
hostname- the host name (optionally wildcard)output- the output value that will be returned byDomainNameMapping.map(String)when the specified host name matches the specified input host name
-
map
-
asMap
Description copied from class:DomainNameMappingReturns a read-onlyMapof the domain mapping patterns and their associated value objects.- Overrides:
asMapin classDomainNameMapping<V>
-
toString
- Overrides:
toStringin classDomainNameMapping<V>
-
estimateBufferSize
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- Parameters:
defaultValueLength- length of string representation ofDomainNameMappingBuilder.defaultValuenumberOfMappings- number of mappings the given instance holds, e.g.}invalid @link
{@link #domainNamePatterns#lengthestimatedMappingLength- estimated size taken by one mapping- Returns:
- estimated length of string returned by
toString()
-
appendMapping
-
appendMapping
private static StringBuilder appendMapping(StringBuilder sb, String domainNamePattern, String value)
-