Top Description Inners Fields Constructors Methods
io.netty5.util

public final Class DomainNameMappingBuilder<V>

extends Object
Class Inheritance
Annotations
@Deprecated
Type Parameters
<V>
concrete type of value objects
Imports
java.util.Collections, .LinkedHashMap, .Map, .Set

Deprecated

Use DomainWildcardMappingBuilder

Builder for immutable DomainNameMapping instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
DomainNameMappingBuilder.ImmutableDomainNameMapping<
concrete type of value objects
V
>

Deprecated as a consequence of DomainNameMapping being deprecated.
Immutable mapping from domain name pattern to its associated value object.

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
DomainNameMappingBuilder(V
the default value for DomainNameMapping#map(String) to return when nothing matches the input
defaultValue
)

Constructor with default initial capacity of the map holding the mappings

public
DomainNameMappingBuilder(int
initial capacity for the internal map
initialCapacity
,
V
the default value for DomainNameMapping#map(String) 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 DomainNameMappingBuilder<V>
add(String
the host name (optionally wildcard)
hostname
,
V
the output value that will be returned by DomainNameMapping#map(String) when the specified host name matches the specified input host name
output
)

Deprecated as a consequence of DomainNameMappingBuilder being deprecated.
Adds a mapping that maps the specified (optionally wildcard) host name to the specified output value.
public DomainNameMapping<V>

Returns:

new DomainNameMapping instance
build
()

Deprecated as a consequence of DomainNameMapping being deprecated.
Creates a new instance of immutable DomainNameMapping Attempts to add new mappings to the result object will cause UnsupportedOperationException to be thrown
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

DomainNameMappingBuilderback to summary
public DomainNameMappingBuilder(V defaultValue)

Constructor with default initial capacity of the map holding the mappings

Parameters
defaultValue:V

the default value for DomainNameMapping#map(String) to return when nothing matches the input

DomainNameMappingBuilderback to summary
public DomainNameMappingBuilder(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 DomainNameMapping#map(String) to return when nothing matches the input

Method Detail

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

Deprecated

as a consequence of DomainNameMappingBuilder being deprecated. See corresponding docs for further information.

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. For example, you can use *.netty.io to match netty.io and downloads.netty.io.

Parameters
hostname:String

the host name (optionally wildcard)

output:V

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

buildback to summary
public DomainNameMapping<V> build()

Deprecated

as a consequence of DomainNameMapping being deprecated. See corresponding docs for further information.

Creates a new instance of immutable DomainNameMapping Attempts to add new mappings to the result object will cause UnsupportedOperationException to be thrown

Returns:DomainNameMapping<V>

new DomainNameMapping instance

io.netty5.util back to summary

private final Class DomainNameMappingBuilder.ImmutableDomainNameMapping<V>

extends DomainNameMapping<V>
Class Inheritance
Type Parameters
<V>
concrete type of value objects

Deprecated

as a consequence of DomainNameMapping being deprecated. See corresponding docs for further information.

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

Modifier and TypeField and Description
private final String[]
private final Map<String, V>
private static final int
private static final String
private static final String
private static final String
private final V[]
Inherited from io.netty5.util.DomainNameMapping:
defaultValue

Constructor Summary

AccessConstructor and Description
private
ImmutableDomainNameMapping(V defaultValue, Map<String, V> map)

Method Summary

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

Overrides io.netty5.util.DomainNameMapping.add.

Deprecated
Adds a mapping that maps the specified (optionally wildcard) host name to the specified output value.
private StringBuilder
appendMapping(StringBuilder sb, int mappingIndex)

private static StringBuilder
appendMapping(StringBuilder sb, String domainNamePattern, String value)

public Map<String, V>
asMap()

Overrides io.netty5.util.DomainNameMapping.asMap.

Returns a read-only Map of the domain mapping patterns and their associated value objects.
private static int

Returns:

estimated length of string returned by toString()
estimateBufferSize
(int
length of string representation of defaultValue
defaultValueLength
,
int
number of mappings the given instance holds, e.g. domainNamePatterns#length
numberOfMappings
,
int
estimated size taken by one mapping
estimatedMappingLength
)

Estimates the length of string representation of the given instance: est = lengthOfConstantComponents + defaultValueLength + (estimatedMappingLength * numOfMappings) * 1.10

public V
map(String hostname)

Overrides io.netty5.util.DomainNameMapping.map.

Implements io.netty5.util.Mapping.map.

Returns mapped value of the specified input.
public String
toString()

Overrides io.netty5.util.DomainNameMapping.toString.

Returns a string representation of the object.
Inherited from io.netty5.util.DomainNameMapping:
matchesnormalizeHostname

Field Detail

domainNamePatternsback to summary
private final String[] domainNamePatterns
mapback to summary
private final Map<String, V> map

Hides io.netty5.util.DomainNameMapping.map.

REPR_CONST_PART_LENGTHback to summary
private static final int REPR_CONST_PART_LENGTH
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
valuesback to summary
private final V[] values

Constructor Detail

ImmutableDomainNameMappingback to summary
private ImmutableDomainNameMapping(V defaultValue, Map<String, V> map)
Annotations
@SuppressWarnings:unchecked

Method Detail

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

Overrides io.netty5.util.DomainNameMapping.add.

Doc from io.netty5.util.DomainNameMapping.add.

Deprecated

Adds 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.io to match netty.io and downloads.netty.io.

Parameters
hostname:String

the host name (optionally wildcard)

output:V

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

Annotations
@Override
@Deprecated
appendMappingback to summary
private StringBuilder appendMapping(StringBuilder sb, int mappingIndex)
appendMappingback to summary
private static StringBuilder appendMapping(StringBuilder sb, String domainNamePattern, String value)
asMapback to summary
public Map<String, V> asMap()

Overrides io.netty5.util.DomainNameMapping.asMap.

Doc from io.netty5.util.DomainNameMapping.asMap.

Returns a read-only Map of the domain mapping patterns and their associated value objects.

Annotations
@Override
estimateBufferSizeback to summary
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:int

length of string representation of defaultValue

numberOfMappings:int

number of mappings the given instance holds, e.g. domainNamePatterns#length

estimatedMappingLength:int

estimated size taken by one mapping

Returns:int

estimated length of string returned by toString()

mapback to summary
public V map(String hostname)

Overrides io.netty5.util.DomainNameMapping.map.

Implements io.netty5.util.Mapping.map.

Doc from io.netty5.util.Mapping.map.

Returns mapped value of the specified input.

Annotations
@Override
toStringback to summary
public String toString()

Overrides io.netty5.util.DomainNameMapping.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override