1 /*
2 * Copyright 2004-2022 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 * https://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 com.ibatis.sqlmap.engine.mapping.sql;
17
18 import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMapping;
19
20 /**
21 * The Class SqlText.
22 */
23 public class SqlText implements SqlChild {
24
25 /** The text. */
26 private String text;
27
28 /** The is white space. */
29 private boolean isWhiteSpace;
30
31 /** The post parse required. */
32 private boolean postParseRequired;
33
34 /** The parameter mappings. */
35 private ParameterMapping[] parameterMappings;
36
37 /**
38 * Gets the text.
39 *
40 * @return the text
41 */
42 public String getText() {
43 return text;
44 }
45
46 /**
47 * Sets the text.
48 *
49 * @param text
50 * the new text
51 */
52 public void setText(String text) {
53 this.text = text.replace('\r', ' ').replace('\n', ' ').replace('\t', ' ');
54 this.isWhiteSpace = text.trim().length() == 0;
55 }
56
57 /**
58 * Checks if is white space.
59 *
60 * @return true, if is white space
61 */
62 public boolean isWhiteSpace() {
63 return isWhiteSpace;
64 }
65
66 /**
67 * Gets the parameter mappings.
68 *
69 * @return the parameter mappings
70 */
71 public ParameterMapping[] getParameterMappings() {
72 return parameterMappings;
73 }
74
75 /**
76 * Sets the parameter mappings.
77 *
78 * @param parameterMappings
79 * the new parameter mappings
80 */
81 public void setParameterMappings(ParameterMapping[] parameterMappings) {
82 this.parameterMappings = parameterMappings;
83 }
84
85 /**
86 * Checks if is post parse required.
87 *
88 * @return true, if is post parse required
89 */
90 public boolean isPostParseRequired() {
91 return postParseRequired;
92 }
93
94 /**
95 * Sets the post parse required.
96 *
97 * @param postParseRequired
98 * the new post parse required
99 */
100 public void setPostParseRequired(boolean postParseRequired) {
101 this.postParseRequired = postParseRequired;
102 }
103
104 }