2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.util;
10 import java.util.Optional;
11 import org.opendaylight.yangtools.yang.model.api.type.ModifierKind;
12 import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
15 * Utility class which provides factory methods to construct Constraints.
18 * Provides static factory methods which constructs instances of
20 * <li>{@link PatternConstraint} - {@link #newPatternConstraint(String, Optional, Optional)}
23 public final class BaseConstraints {
24 private BaseConstraints() {
25 throw new UnsupportedOperationException();
29 * Creates a {@link PatternConstraint}.
32 * Creates an instance of Pattern constraint based on supplied parameters
33 * with additional behaviour:
35 * <li>{@link PatternConstraint#getErrorAppTag()} returns
36 * <code>invalid-regular-expression</code>
39 * @see PatternConstraint
42 * Regular expression, MUST NOT BE null.
44 * Description associated with constraint.
46 * Reference associated with constraint.
47 * @return Instance of {@link PatternConstraint}
49 public static PatternConstraint newPatternConstraint(final String pattern, final Optional<String> description,
50 final Optional<String> reference) {
51 return new PatternConstraintImpl(pattern, description, reference);
55 * Creates a {@link PatternConstraint}.
58 * Creates an instance of Pattern constraint based on supplied parameters
59 * with additional behaviour:
61 * <li>{@link PatternConstraint#getErrorAppTag()} returns
62 * <code>invalid-regular-expression</code>
65 * @see PatternConstraint
68 * Regular expression, MUST NOT BE null.
70 * Description associated with constraint.
72 * Reference associated with constraint.
74 * error-app-tag associated with constraint.
76 * error message associated with constraint.
78 * Modifier of pattern constraint.
79 * @return Instance of {@link PatternConstraint}
81 public static PatternConstraint newPatternConstraint(final String pattern, final Optional<String> description,
82 final Optional<String> reference, final String errorAppTag, final String errorMessage,
83 final Optional<ModifierKind> modifier) {
84 return new PatternConstraintImpl(pattern, description, reference, errorAppTag, errorMessage, modifier);