All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.config.provision.HostName Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;

import ai.vespa.http.DomainName;

import static ai.vespa.validation.Validation.require;
import static ai.vespa.validation.Validation.requireLength;

/**
 * Hostnames match {@link #domainNamePattern}, and are restricted to 64 characters in length.
 *
 * @author jonmv
 */
public class HostName extends DomainName {

    private HostName(String value) {
        super(requireLength(require( ! value.endsWith("."),
                                     value, "hostname cannot end with '.'"),
                            "hostname length", 1, 64),
              "hostname");
    }

    public static HostName of(String value) {
        return new HostName(value);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy