summaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/identifiers/ApplicationId.java
blob: fceecedb9fe04d87e633ff65ec8eacd9e497b788 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.identifiers;

/**
 * @author smorgrav
 */
public class ApplicationId extends NonDefaultIdentifier {

    public ApplicationId(String id) {
        super(id);
    }

    public static boolean isLegal(String id) {
        return strictPattern.matcher(id).matches();
    }
    
    @Override
    public void validate() {
        super.validate();
        validateNoUpperCase();
    }

    public static void validate(String id) {
        if (!isLegal(id)) {
            throwInvalidId(id, strictPatternExplanation);
        }
    }

}