93e252a6d3e8767f7be95fb7eb94147f87cfa0d3
[appc.git] / appc-config / appc-config-generator / provider / src / main / java / org / onap / sdnc / config / generator / tool / CustomTextNode.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APP-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property.  All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdnc.config.generator.tool;
22
23
24 import com.fasterxml.jackson.core.io.CharTypes;
25 import com.fasterxml.jackson.databind.node.TextNode;
26
27 public class CustomTextNode extends TextNode{
28
29     public CustomTextNode(String v) {
30         super(v);
31     }
32     
33     @Override
34     public String toString()
35     {
36         int len = textValue().length();
37         len = len + 2 + (len >> 4);
38         StringBuilder sb = new StringBuilder(len);
39         appendQuoted(sb, textValue());
40         return sb.toString();
41     }
42
43     protected static void appendQuoted(StringBuilder sb, String content)
44     {
45        // sb.append('"');
46         CharTypes.appendQuoted(sb, content);
47        // sb.append('"');
48     }
49     
50 }