Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/tripi/asp/ConstValue.java


1   /**
2    * ArrowHead ASP Server 
3    * This is a source file for the ArrowHead ASP Server - an 100% Java
4    * VBScript interpreter and ASP server.
5    *
6    * For more information, see http://www.tripi.com/arrowhead
7    *
8    * Copyright (C) 2002  Terence Haddock
9    *
10   * This program is free software; you can redistribute it and/or modify
11   * it under the terms of the GNU General Public License as published by
12   * the Free Software Foundation; either version 2 of the License, or
13   * (at your option) any later version.
14   *
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Public License for more details.
19   *
20   * You should have received a copy of the GNU General Public License
21   * along with this program; if not, write to the Free Software
22   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23   *
24   */
25  package com.tripi.asp;
26  
27  /**
28   * ConstValue handles constant values, preventing changing the value.
29   *
30   * @author Terence Haddock
31   * @version 0.9
32   */
33  public class ConstValue implements SimpleReference
34  {
35      /** Value this constant contains */
36      Object value;
37  
38      /**
39       * Constructor.
40       * @param value Value this constant contains.
41       */
42      public ConstValue(Object value)
43      {
44          this.value = value;
45      }
46  
47      /**
48       * Sets the value of this variable, throws an error for these 
49       * constant values.
50       * @param value New value for this node.
51       * @throws AspReadOnlyException when called.
52       * @see SimpleReference#setValue
53       */
54      public void setValue(Object value) throws AspException
55      {
56          throw new AspReadOnlyException("Constant expression");
57      }
58  
59      /**
60       * Obtains the value of this variable
61       * @return Value of this expression.
62       * @see SimpleReference#getValue
63       */
64      public Object getValue() throws AspException
65      {
66          return value;    
67      }
68  };
69