KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > udf > NullValueUdf


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/udf/NullValueUdf.java#1 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2005-2007 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.udf;
11
12 import mondrian.olap.*;
13 import mondrian.olap.type.*;
14 import mondrian.rolap.RolapUtil;
15 import mondrian.spi.UserDefinedFunction;
16
17 /**
18  * Definition of the user-defined function "NullValue" which always
19  * returns Java "null".
20  *
21  * @author remberson,jhyde
22  * @version $Id: //open/mondrian/src/main/mondrian/udf/NullValueUdf.java#1 $
23  */

24 public class NullValueUdf implements UserDefinedFunction {
25
26     public String JavaDoc getName() {
27         return "NullValue";
28     }
29
30     public String JavaDoc getDescription() {
31         return "Returns the null value";
32     }
33
34     public Syntax getSyntax() {
35         return Syntax.Function;
36     }
37
38     public Type getReturnType(Type[] parameterTypes) {
39         return new NumericType();
40     }
41
42     public Type[] getParameterTypes() {
43         return new Type[0];
44     }
45
46     public Object JavaDoc execute(Evaluator evaluator, Argument[] arguments) {
47         return Util.nullValue;
48     }
49
50     public String JavaDoc[] getReservedWords() {
51         // This function does not require any reserved words.
52
return null;
53     }
54 }
55
56 // End NullUdf.java
57
Popular Tags