Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame^] | 1 | /*Copyright 2016.year Open Networking Laboratory |
| 2 | |
| 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | you may not use this file except in compliance with the License. |
| 5 | You may obtain a copy of the License at |
| 6 | |
| 7 | http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | |
| 9 | Unless required by applicable law or agreed to in writing, software |
| 10 | distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | See the License for the specific language governing permissions and |
| 13 | limitations under the License.*/ |
| 14 | package org.onosproject.yangutils.datamodel; |
| 15 | |
| 16 | import java.util.List; |
| 17 | |
| 18 | /*- |
| 19 | * Reference RFC 6020. |
| 20 | * |
| 21 | * The pattern Statement |
| 22 | * |
| 23 | * The "pattern" statement, which is an optional sub-statement to the |
| 24 | * "type" statement, takes as an argument a regular expression string. |
| 25 | * It is used to restrict the built-in type "string", or types derived |
| 26 | * from "string", to values that match the pattern. |
| 27 | * |
| 28 | * If the type has multiple "pattern" statements, the expressions are |
| 29 | * ANDed together, i.e., all such expressions have to match. |
| 30 | * |
| 31 | * If a pattern restriction is applied to an already pattern-restricted |
| 32 | * type, values must match all patterns in the base type, in addition to |
| 33 | * the new patterns. |
| 34 | * The pattern's sub-statements |
| 35 | * |
| 36 | * +---------------+---------+-------------+ |
| 37 | * | substatement | section | cardinality | |
| 38 | * +---------------+---------+-------------+ |
| 39 | * | description | 7.19.3 | 0..1 | |
| 40 | * | error-app-tag | 7.5.4.2 | 0..1 | |
| 41 | * | error-message | 7.5.4.1 | 0..1 | |
| 42 | * | reference | 7.19.4 | 0..1 | |
| 43 | * +---------------+---------+-------------+ |
| 44 | */ |
| 45 | /** |
| 46 | * Pattern restriction information. The regular expression restriction on string |
| 47 | * data type. |
| 48 | */ |
| 49 | public class YangPatternRestriction { |
| 50 | |
| 51 | /** |
| 52 | * Pattern restriction defined for the current type. |
| 53 | */ |
| 54 | private List<String> pattern; |
| 55 | |
| 56 | /** |
| 57 | * Effective pattern restriction that needs inherited from base type. |
| 58 | */ |
| 59 | private List<String> basePattern; |
| 60 | |
| 61 | /** |
| 62 | * Default constructor. |
| 63 | */ |
| 64 | public YangPatternRestriction() { |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Get the pattern restriction defined for the current type. |
| 69 | * |
| 70 | * @return pattern restriction defined for the current type. |
| 71 | */ |
| 72 | public List<String> getPattern() { |
| 73 | return pattern; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Set the pattern restriction defined for the current type. |
| 78 | * |
| 79 | * @param pattern pattern restriction defined for the current type.. |
| 80 | */ |
| 81 | public void setPattern(List<String> pattern) { |
| 82 | this.pattern = pattern; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Get the pattern restriction defined in base type. |
| 87 | * |
| 88 | * @return pattern restriction defined in base type. |
| 89 | */ |
| 90 | public List<String> getBasePattern() { |
| 91 | return basePattern; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Set the pattern restriction defined in base type. |
| 96 | * |
| 97 | * @param basePattern pattern restriction defined in base type. |
| 98 | */ |
| 99 | public void setBasePattern(List<String> basePattern) { |
| 100 | this.basePattern = basePattern; |
| 101 | } |
| 102 | } |