001 /*
002 // $Id: //open/mondrian-release/3.0/src/main/mondrian/udf/NullValueUdf.java#2 $
003 // This software is subject to the terms of the Common Public License
004 // Agreement, available at the following URL:
005 // http://www.opensource.org/licenses/cpl.html.
006 // Copyright (C) 2005-2007 Julian Hyde
007 // All Rights Reserved.
008 // You must accept the terms of that agreement to use this software.
009 */
010 package mondrian.udf;
011
012 import mondrian.olap.*;
013 import mondrian.olap.type.*;
014 import mondrian.rolap.RolapUtil;
015 import mondrian.spi.UserDefinedFunction;
016
017 /**
018 * Definition of the user-defined function "NullValue" which always
019 * returns Java "null".
020 *
021 * @author remberson,jhyde
022 * @version $Id: //open/mondrian-release/3.0/src/main/mondrian/udf/NullValueUdf.java#2 $
023 */
024 public class NullValueUdf implements UserDefinedFunction {
025
026 public String getName() {
027 return "NullValue";
028 }
029
030 public String getDescription() {
031 return "Returns the null value";
032 }
033
034 public Syntax getSyntax() {
035 return Syntax.Function;
036 }
037
038 public Type getReturnType(Type[] parameterTypes) {
039 return new NumericType();
040 }
041
042 public Type[] getParameterTypes() {
043 return new Type[0];
044 }
045
046 public Object execute(Evaluator evaluator, Argument[] arguments) {
047 return Util.nullValue;
048 }
049
050 public String[] getReservedWords() {
051 // This function does not require any reserved words.
052 return null;
053 }
054 }
055
056 // End NullUdf.java