Top Description Inners Fields Constructors Methods
io.netty.util

public Class DomainWildcardMappingBuilder<V>

extends Object
Class Inheritance
Type Parameters
<V>
the type of the value that we map to.
Imports
java.util.LinkedHashMap, .Map

Builder that allows to build Mappings that support DNS wildcard matching.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final V
private final Map<String, V>

Constructor Summary

AccessConstructor and Description
public
DomainWildcardMappingBuilder(V
the default value for Mapping#map(Object) )} to return when nothing matches the input
defaultValue
)

Constructor with default initial capacity of the map holding the mappings

public
DomainWildcardMappingBuilder(int
initial capacity for the internal map
initialCapacity
,
V
the default value for Mapping#map(Object) to return when nothing matches the input
defaultValue
)

Constructor with initial capacity of the map holding the mappings

Method Summary

Modifier and TypeMethod and Description
public DomainWildcardMappingBuilder<V>
add(String
the host name (optionally wildcard)
hostname
,
V
the output value that will be returned by Mapping#map(Object) when the specified host name matches the specified input host name
output
)

Adds a mapping that maps the specified (optionally wildcard) host name to the specified output value.

public Mapping<String, V>

Returns:

new Mapping instance
build
()

Creates a new instance of an immutable Mapping.

private String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultValueback to summary
private final V defaultValue
mapback to summary
private final Map<String, V> map

Constructor Detail

DomainWildcardMappingBuilderback to summary
public DomainWildcardMappingBuilder(V defaultValue)

Constructor with default initial capacity of the map holding the mappings

Parameters
defaultValue:V

the default value for Mapping#map(Object) )} to return when nothing matches the input

DomainWildcardMappingBuilderback to summary
public DomainWildcardMappingBuilder(int initialCapacity, V defaultValue)

Constructor with initial capacity of the map holding the mappings

Parameters
initialCapacity:int

initial capacity for the internal map

defaultValue:V

the default value for Mapping#map(Object) to return when nothing matches the input

Method Detail

addback to summary
public DomainWildcardMappingBuilder<V> add(String hostname, V output)

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:String

the host name (optionally wildcard)

output:V

the output value that will be returned by Mapping#map(Object) when the specified host name matches the specified input host name

buildback to summary
public Mapping<String, V> build()

Creates a new instance of an immutable Mapping.

Returns:Mapping<String, V>

new Mapping instance

normalizeHostNameback to summary
private String normalizeHostName(String hostname)
io.netty.util back to summary

private final Class DomainWildcardMappingBuilder.ImmutableDomainWildcardMapping<V>

extends Object
implements Mapping<String, V>
Class Inheritance
  • java.lang.Object
  • io.netty.util.DomainWildcardMappingBuilder.ImmutableDomainWildcardMapping
All Implemented Interfaces
io.netty.util.Mapping

Field Summary

Modifier and TypeField and Description
private final V
private final Map<String, V>
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv
ImmutableDomainWildcardMapping(V defaultValue, Map<String, V> map)

Method Summary

Modifier and TypeMethod and Description
public V
map(String hostname)

Implements io.netty.util.Mapping.map.

Returns mapped value of the specified input.
pack-priv static String
normalize(String hostname)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

defaultValueback to summary
private final V defaultValue
mapback to summary
private final Map<String, V> map
REPR_HEADERback to summary
private static final String REPR_HEADER
REPR_MAP_CLOSINGback to summary
private static final String REPR_MAP_CLOSING
REPR_MAP_OPENINGback to summary
private static final String REPR_MAP_OPENING

Constructor Detail

ImmutableDomainWildcardMappingback to summary
pack-priv ImmutableDomainWildcardMapping(V defaultValue, Map<String, V> map)

Method Detail

mapback to summary
public V map(String hostname)

Implements io.netty.util.Mapping.map.

Doc from io.netty.util.Mapping.map.

Returns mapped value of the specified input.

Annotations
@Override
normalizeback to summary
pack-priv static String normalize(String hostname)
Annotations
@SuppressWarnings:deprecation
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override