KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > controls > system > jdbc > parser > LiteralFragment


1 /*
2  * Copyright 2005 The Apache Software Foundation.
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  * $Header:$
17  */

18
19 package org.apache.beehive.controls.system.jdbc.parser;
20
21 import org.apache.beehive.controls.api.context.ControlBeanContext;
22
23 import java.lang.reflect.Method JavaDoc;
24
25 /**
26  * Represents a portion of the SQL annotation's statement member which is not within substitution delimiters.
27  * The parser creates LiteralFragements for portions of the SQL statement which do not require any special processing.
28  */

29 public final class LiteralFragment extends SqlFragment {
30
31     private final String JavaDoc _value;
32
33     /**
34      * Create an new LiteralFragment with the specified value.
35      * @param value Value of this fragment.
36      */

37     LiteralFragment(String JavaDoc value) {
38         _value = value;
39     }
40
41     /**
42      * Get the text for a PreparedStatement
43      * @param context A ControlBeanContext instance
44      * @param m The annotated method.
45      * @param args The method's parameters.
46      * @return A String containing the literal value for this fragment.
47      */

48     String JavaDoc getPreparedStatementText(ControlBeanContext context, Method JavaDoc m, Object JavaDoc[] args) {
49        return _value;
50     }
51
52     /**
53      * Required for JUnit testing.
54      * @return The String value of this fragment.
55      */

56     public String JavaDoc toString() {
57         return _value;
58     }
59 }
60
Popular Tags