01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: * $Header:$
18: */
19:
20: package org.apache.beehive.controls.system.jdbc.parser;
21:
22: import org.apache.beehive.controls.api.context.ControlBeanContext;
23:
24: import java.lang.reflect.Method;
25:
26: /**
27: * Represents a portion of the SQL annotation's statement member which is not within substitution delimiters.
28: * The parser creates LiteralFragements for portions of the SQL statement which do not require any special processing.
29: */
30: public final class LiteralFragment extends SqlFragment {
31:
32: private final String _value;
33:
34: /**
35: * Create an new LiteralFragment with the specified value.
36: * @param value Value of this fragment.
37: */
38: LiteralFragment(String value) {
39: _value = value;
40: }
41:
42: /**
43: * Get the text for a PreparedStatement
44: * @param context A ControlBeanContext instance
45: * @param m The annotated method.
46: * @param args The method's parameters.
47: * @return A String containing the literal value for this fragment.
48: */
49: String getPreparedStatementText(ControlBeanContext context,
50: Method m, Object[] args) {
51: return _value;
52: }
53:
54: /**
55: * Required for JUnit testing.
56: * @return The String value of this fragment.
57: */
58: public String toString() {
59: return _value;
60: }
61: }
|