aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/ai/vespa/validation/PatternedStringWrapper.java
blob: b97a7ed9cc16a1209d9676ea17661408cf5fbb94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.validation;

import java.util.regex.Pattern;

import static ai.vespa.validation.Validation.requireMatch;

/**
 * Helper to easily create {@link StringWrapper} classes whose contents match a specific regex.
 *
 * @author jonmv
 */
public abstract class PatternedStringWrapper<T extends PatternedStringWrapper<T>> extends StringWrapper<T> {

    protected PatternedStringWrapper(String value, Pattern pattern, String description) {
        super(requireMatch(value, description, pattern));
    }

}