KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > templates > XUnresolvedVariableSimple


1 /*
2  * Copyright 1999-2004 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 /*
17  * $Id: XUnresolvedVariableSimple.java,v 1.5 2004/02/16 20:32:33 minchau Exp $
18  */

19 package org.apache.xalan.templates;
20
21 import org.apache.xpath.Expression;
22 import org.apache.xpath.XPathContext;
23 import org.apache.xpath.objects.XObject;
24
25
26 /**
27  * This is the same as XUnresolvedVariable, but it assumes that the
28  * context is already set up. For use with psuedo variables.
29  * Also, it holds an Expression object, instead of an ElemVariable.
30  * It must only hold static context, since a single copy will be
31  * held in the template.
32  */

33 public class XUnresolvedVariableSimple extends XObject
34 {
35   public XUnresolvedVariableSimple(ElemVariable obj)
36   {
37     super(obj);
38   }
39     
40     
41   /**
42    * For support of literal objects in xpaths.
43    *
44    * @param xctxt The XPath execution context.
45    *
46    * @return This object.
47    *
48    * @throws javax.xml.transform.TransformerException
49    */

50   public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException JavaDoc
51   {
52     Expression expr = ((ElemVariable)m_obj).getSelect().getExpression();
53     XObject xobj = expr.execute(xctxt);
54     xobj.allowDetachToRelease(false);
55     return xobj;
56   }
57   
58   /**
59    * Tell what kind of class this is.
60    *
61    * @return CLASS_UNRESOLVEDVARIABLE
62    */

63   public int getType()
64   {
65     return CLASS_UNRESOLVEDVARIABLE;
66   }
67   
68   /**
69    * Given a request type, return the equivalent string.
70    * For diagnostic purposes.
71    *
72    * @return An informational string.
73    */

74   public String JavaDoc getTypeString()
75   {
76     return "XUnresolvedVariableSimple (" + object().getClass().getName() + ")";
77   }
78
79
80 }
81
82
Popular Tags