KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > xquery > parser > Value


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  * Copyright (C) 2003 XQuark Group.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
19  * You can also get it at http://www.gnu.org/licenses/lgpl.html
20  *
21  * For more information on this software, see http://www.xquark.org.
22  */

23
24
25 package org.xquark.xquery.parser;
26
27 import org.xquark.xquery.typing.TypeException;
28
29
30 public abstract class Value extends XQueryExpression implements Cloneable JavaDoc {
31     private static final String JavaDoc RCSRevision = "$Revision: 1.8 $";
32     private static final String JavaDoc RCSName = "$Name: $";
33     
34     // cannot be null or empty string
35
protected String JavaDoc value = null;
36     
37     // #############################################################################
38
// VISITOR STUFF
39
// #############################################################################
40

41     public void accept(ParserVisitor visitor) throws XQueryException {
42         visitor.visit(this);
43     }
44     
45     // #############################################################################
46
// CONSTRUCTOR STUFF
47
// #############################################################################
48

49     public Value(String JavaDoc value) throws TypeException, XQueryException {
50         setValue(value);
51     }
52     
53     // #############################################################################
54
// ATTRIBUTE SETTING STUFF
55
// #############################################################################
56

57     public String JavaDoc getValue() { return value; }
58     abstract public Object JavaDoc getObjectValue();
59     public void setValue(String JavaDoc value) throws XQueryException {
60         // cannot be null or empty string
61
if (value == null)
62             throw new XQueryException("value of Value cannot be null");
63         // if (value == null || value.equals("")) throw new Exception("value of Value cannot be null or empty string");
64
this.value = value;
65     }
66         
67 }
68
69
70
71
Popular Tags