blob: 13925bc7f299da1244c4996d5832654f73fe7358 [file] [log] [blame]
Gaurav Agrawala04483c2016-02-13 14:23:40 +05301/*
2 * Copyright 2016 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.yangutils.parser.impl.parserutils;
18
19/**
20 * Maintains listener error type.
21 */
22public enum ListenerErrorType {
23 /**
24 * Represents the parent holder in parsable stack for given YANG construct is invalid.
25 */
26 INVALID_HOLDER(),
27
28 /**
29 * Represents the parent holder in parsable stack for given YANG construct is missing.
30 */
31 MISSING_HOLDER(),
32
33 /**
34 * Represents the current holder in parsable stack for given YANG construct is missing.
35 */
36 MISSING_CURRENT_HOLDER(),
37
38 /**
39 * Represents that the child in parsable stack for given YANG construct is invalid.
40 */
41 INVALID_CHILD(),
42
43 /**
44 * Represents that the cardinality for given YANG construct is invalid.
45 */
46 INVALID_CARDINALITY(),
47
48 /**
49 * Represents that some of earlier parsed data is not handled correctly.
50 */
51 UNHANDLED_PARSED_DATA();
52
53 /**
54 * Returns the message corresponding to listener error type.
55 *
56 * @param errorType enum value for type of error.
57 * @return message corresponding to listener error type.
58 */
59 public static String getErrorType(ListenerErrorType errorType) {
60
61 switch (errorType) {
62 case INVALID_HOLDER:
63 return "Invalid holder for";
64 case MISSING_HOLDER:
65 return "Missing holder at";
66 case MISSING_CURRENT_HOLDER:
67 return "Missing";
68 case INVALID_CHILD:
69 return "Invalid child in";
70 case INVALID_CARDINALITY:
71 return "Invalid cardinality in";
72 case UNHANDLED_PARSED_DATA:
73 return "Unhandled parsed data at";
74 default:
75 return "Problem in";
76 }
77 }
78}