View Javadoc
1   /**
2    *    Copyright 2006-2016 the original author or authors.
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  package org.mybatis.generator.api.dom.xml;
17  
18  import org.mybatis.generator.api.dom.OutputUtilities;
19  
20  /**
21   * The Class TextElement.
22   *
23   * @author Jeff Butler
24   */
25  public class TextElement extends Element {
26      
27      /** The content. */
28      private String content;
29  
30      /**
31       * Instantiates a new text element.
32       *
33       * @param content
34       *            the content
35       */
36      public TextElement(String content) {
37          super();
38          this.content = content;
39      }
40  
41      /* (non-Javadoc)
42       * @see org.mybatis.generator.api.dom.xml.Element#getFormattedContent(int)
43       */
44      @Override
45      public String getFormattedContent(int indentLevel) {
46          StringBuilder sb = new StringBuilder();
47          OutputUtilities.xmlIndent(sb, indentLevel);
48          sb.append(content);
49          return sb.toString();
50      }
51  
52      /**
53       * Gets the content.
54       *
55       * @return the content
56       */
57      public String getContent() {
58          return content;
59      }
60  }