Package io.netty.util
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
- All Implemented Interfaces:
Mapping<java.lang.String,V>
- 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
Fields Modifier and Type Field Description private java.lang.String[]domainNamePatternsprivate java.util.Map<java.lang.String,V>mapprivate static intREPR_CONST_PART_LENGTHprivate static java.lang.StringREPR_HEADERprivate static java.lang.StringREPR_MAP_CLOSINGprivate static java.lang.StringREPR_MAP_OPENINGprivate V[]values-
Fields inherited from class io.netty.util.DomainNameMapping
defaultValue
-
-
Constructor Summary
Constructors Modifier Constructor Description privateImmutableDomainNameMapping(V defaultValue, java.util.Map<java.lang.String,V> map)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DomainNameMapping<V>add(java.lang.String hostname, V output)Deprecated.private java.lang.StringBuilderappendMapping(java.lang.StringBuilder sb, int mappingIndex)private static java.lang.StringBuilderappendMapping(java.lang.StringBuilder sb, java.lang.String domainNamePattern, java.lang.String value)java.util.Map<java.lang.String,V>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.10Vmap(java.lang.String hostname)Returns mapped value of the specified input.java.lang.StringtoString()-
Methods inherited from class io.netty.util.DomainNameMapping
matches, normalizeHostname
-
-
-
-
Field Detail
-
REPR_HEADER
private static final java.lang.String REPR_HEADER
- See Also:
- Constant Field Values
-
REPR_MAP_OPENING
private static final java.lang.String REPR_MAP_OPENING
- See Also:
- Constant Field Values
-
REPR_MAP_CLOSING
private static final java.lang.String REPR_MAP_CLOSING
- See Also:
- Constant Field Values
-
REPR_CONST_PART_LENGTH
private static final int REPR_CONST_PART_LENGTH
-
domainNamePatterns
private final java.lang.String[] domainNamePatterns
-
values
private final V[] values
-
map
private final java.util.Map<java.lang.String,V> map
-
-
Method Detail
-
add
@Deprecated public DomainNameMapping<V> add(java.lang.String hostname, V output)
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
public V map(java.lang.String hostname)
Description copied from interface:MappingReturns mapped value of the specified input.
-
asMap
public java.util.Map<java.lang.String,V> asMap()
Description copied from class:DomainNameMappingReturns a read-onlyMapof the domain mapping patterns and their associated value objects.- Overrides:
asMapin classDomainNameMapping<V>
-
toString
public java.lang.String 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. {@link #domainNamePatterns#length}estimatedMappingLength- estimated size taken by one mapping- Returns:
- estimated length of string returned by
toString()
-
appendMapping
private java.lang.StringBuilder appendMapping(java.lang.StringBuilder sb, int mappingIndex)
-
appendMapping
private static java.lang.StringBuilder appendMapping(java.lang.StringBuilder sb, java.lang.String domainNamePattern, java.lang.String value)
-
-