Home / Class/ DomainMappingBuilder Class — netty Architecture

DomainMappingBuilder Class — netty Architecture

Architecture documentation for the DomainMappingBuilder class in DomainMappingBuilder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3cdd66f7_3bbd_5247_9ca6_29763812677c["DomainMappingBuilder"]
  9fe5a0d3_19a3_d46c_8e15_21a4cc134b9a["DomainMappingBuilder.java"]
  3cdd66f7_3bbd_5247_9ca6_29763812677c -->|defined in| 9fe5a0d3_19a3_d46c_8e15_21a4cc134b9a
  f6a971a1_1942_a097_0466_c884478ac013["DomainMappingBuilder()"]
  3cdd66f7_3bbd_5247_9ca6_29763812677c -->|method| f6a971a1_1942_a097_0466_c884478ac013
  8787bc50_d0f5_c4e5_8dd5_bec30bc8f874["add()"]
  3cdd66f7_3bbd_5247_9ca6_29763812677c -->|method| 8787bc50_d0f5_c4e5_8dd5_bec30bc8f874
  1d5e0576_1deb_1fd1_df90_6283bb170748["build()"]
  3cdd66f7_3bbd_5247_9ca6_29763812677c -->|method| 1d5e0576_1deb_1fd1_df90_6283bb170748

Relationship Graph

Source Code

common/src/main/java/io/netty/util/DomainMappingBuilder.java lines 25–77

@Deprecated
public final class DomainMappingBuilder<V> {

    private final DomainNameMappingBuilder<V> builder;

    /**
     * Constructor with default initial capacity of the map holding the mappings
     *
     * @param defaultValue the default value for {@link DomainNameMapping#map(String)} to return
     *                     when nothing matches the input
     */
    public DomainMappingBuilder(V defaultValue) {
        builder = new DomainNameMappingBuilder<V>(defaultValue);
    }

    /**
     * Constructor with initial capacity of the map holding the mappings
     *
     * @param initialCapacity initial capacity for the internal map
     * @param defaultValue    the default value for {@link DomainNameMapping#map(String)} to return
     *                        when nothing matches the input
     */
    public DomainMappingBuilder(int initialCapacity, V defaultValue) {
        builder = new DomainNameMappingBuilder<V>(initialCapacity, defaultValue);
    }

    /**
     * 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.
     * <p>
     * <a href="https://en.wikipedia.org/wiki/Wildcard_DNS_record">DNS wildcard</a> is supported as hostname.
     * For example, you can use {@code *.netty.io} to match {@code netty.io} and {@code downloads.netty.io}.
     * </p>
     *
     * @param hostname the host name (optionally wildcard)
     * @param output   the output value that will be returned by {@link DomainNameMapping#map(String)}
     *                 when the specified host name matches the specified input host name
     */
    public DomainMappingBuilder<V> add(String hostname, V output) {
        builder.add(hostname, output);
        return this;
    }

    /**
     * Creates a new instance of immutable {@link DomainNameMapping}
     * Attempts to add new mappings to the result object will cause {@link UnsupportedOperationException} to be thrown
     *
     * @return new {@link DomainNameMapping} instance
     */
    public DomainNameMapping<V> build() {
        return builder.build();
    }
}

Frequently Asked Questions

What is the DomainMappingBuilder class?
DomainMappingBuilder is a class in the netty codebase, defined in common/src/main/java/io/netty/util/DomainMappingBuilder.java.
Where is DomainMappingBuilder defined?
DomainMappingBuilder is defined in common/src/main/java/io/netty/util/DomainMappingBuilder.java at line 25.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free