Replace non-Javadoc comments with inheritDocs
[policy/apex-pdp.git] / services / services-engine / src / main / java / org / onap / policy / apex / service / parameters / eventprotocol / EventProtocolTextCharDelimitedParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  * 
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  * 
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * 
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.service.parameters.eventprotocol;
22
23 import org.onap.policy.common.parameters.GroupValidationResult;
24 import org.onap.policy.common.parameters.ValidationStatus;
25
26 /**
27  * An event protocol parameter class for character delimited textual event protocols that may be specialized by event
28  * protocol plugins that require plugin specific parameters.
29  *
30  * <p>The following parameters are defined:
31  * <ol>
32  * <li>startChar: starting character delimiter for text blocks containing an event.
33  * <li>endChar: ending character delimiter for text blocks containing an event.
34  * </ol>
35  *
36  * @author Liam Fallon (liam.fallon@ericsson.com)
37  */
38 public abstract class EventProtocolTextCharDelimitedParameters extends EventProtocolParameters {
39     // The starting and ending character delimiter
40     private char startChar = '\0';
41     private char endChar = '\0';
42
43     /**
44      * Constructor to create an event protocol parameters instance with the name of a sub class of this class.
45      */
46     public EventProtocolTextCharDelimitedParameters() {
47         super();
48     }
49
50     /**
51      * Gets the start character that delimits the start of text blocks.
52      *
53      * @return the start char
54      */
55     public char getStartChar() {
56         return startChar;
57     }
58
59     /**
60      * Sets the start character that delimits the start of text blocks.
61      *
62      * @param startChar the start character
63      */
64     public void setStartChar(final char startChar) {
65         this.startChar = startChar;
66     }
67
68     /**
69      * Gets the end character that delimits the end of text blocks.
70      *
71      * @return the end character
72      */
73     public char getEndChar() {
74         return endChar;
75     }
76
77     /**
78      * Sets the end character that delimits the end of text blocks.
79      *
80      * @param endChar the end character
81      */
82     public void setEndChar(final char endChar) {
83         this.endChar = endChar;
84     }
85
86     /**
87      * {@inheritDoc}.
88      */
89     @Override
90     public String toString() {
91         return "EventProtocolTextCharDelimitedParameters {" + super.toString() + "} [startChar=" + startChar
92                         + ", endChar=" + endChar + "]";
93     }
94
95     /**
96      * {@inheritDoc}.
97      */
98     @Override
99     public GroupValidationResult validate() {
100         final GroupValidationResult result = super.validate();
101
102         if (startChar == '\0') {
103             result.setResult("startChar", ValidationStatus.INVALID,
104                             "text character delimited start character has not been specified");
105         }
106
107         if (endChar == '\0') {
108             result.setResult("endChar", ValidationStatus.INVALID,
109                             "text character delimited end character has not been specified\n");
110         }
111
112         return result;
113     }
114 }