Package io.netty.util
Class DomainWildcardMappingBuilder<V>
java.lang.Object
io.netty.util.DomainWildcardMappingBuilder<V>
- Type Parameters:
V
- the type of the value that we map to.
Builder that allows to build
Mapping
s that support
DNS wildcard matching.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDomainWildcardMappingBuilder
(int initialCapacity, V defaultValue) Constructor with initial capacity of the map holding the mappingsDomainWildcardMappingBuilder
(V defaultValue) Constructor with default initial capacity of the map holding the mappings -
Method Summary
Modifier and TypeMethodDescriptionAdds a mapping that maps the specified (optionally wildcard) host name to the specified output value.build()
Creates a new instance of an immutableMapping
.private String
normalizeHostName
(String hostname)
-
Field Details
-
defaultValue
-
map
-
-
Constructor Details
-
DomainWildcardMappingBuilder
Constructor with default initial capacity of the map holding the mappings- Parameters:
defaultValue
- the default value forMapping.map(Object)
)} to return when nothing matches the input
-
DomainWildcardMappingBuilder
Constructor with initial capacity of the map holding the mappings- Parameters:
initialCapacity
- initial capacity for the internal mapdefaultValue
- the default value forMapping.map(Object)
to return when nothing matches the input
-
-
Method Details
-
add
Adds a mapping that maps the specified (optionally wildcard) host name to the specified output value.null
values are forbidden for both hostnames and values.DNS wildcard is supported as hostname. The wildcard will only match one sub-domain deep and only when wildcard is used as the most-left label. For example:
*.netty.io will match xyz.netty.io but NOT abc.xyz.netty.io
- Parameters:
hostname
- the host name (optionally wildcard)output
- the output value that will be returned byMapping.map(Object)
when the specified host name matches the specified input host name
-
normalizeHostName
-
build
Creates a new instance of an immutableMapping
.- Returns:
- new
Mapping
instance
-