Upgrade to OpenDaylight Chlorine version of poms
[sdnc/northbound.git] / generic-resource-api / provider / src / test / java / org / onap / sdnc / northbound / util / PropBuilder.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : SDN-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.sdnc.northbound.util;
23
24
25 import java.util.Properties;
26
27 /**
28  * A Util class that adds method chaining to the {@link #set(String, String)} to reducing the syntax needed to populate
29  * {@link Properties}
30  */
31 public class PropBuilder {
32
33
34     final Properties prop;
35
36     public PropBuilder(Properties prop) {
37         this.prop = prop;
38     }
39
40     public PropBuilder() {
41         this.prop = new Properties();
42     }
43
44     public Properties build(){
45         return prop;
46     }
47
48     public PropBuilder set(String key, String value) {
49         prop.setProperty(key, value);
50         return this;
51     }
52
53     public String get(String key) {
54         return prop.getProperty(key);
55     }
56
57
58     public static PropBuilder propBuilder(){
59         return (new PropBuilder());
60     }
61 }