001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2005-2009 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.udf;
011
012import mondrian.olap.*;
013import mondrian.olap.type.NumericType;
014import mondrian.olap.type.Type;
015import 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 */
023public class NullValueUdf implements UserDefinedFunction {
024
025    public String getName() {
026        return "NullValue";
027    }
028
029    public String getDescription() {
030        return "Returns the null value";
031    }
032
033    public Syntax getSyntax() {
034        return Syntax.Function;
035    }
036
037    public Type getReturnType(Type[] parameterTypes) {
038        return new NumericType();
039    }
040
041    public Type[] getParameterTypes() {
042        return new Type[0];
043    }
044
045    public Object execute(Evaluator evaluator, Argument[] arguments) {
046        return Util.nullValue;
047    }
048
049    public String[] getReservedWords() {
050        // This function does not require any reserved words.
051        return null;
052    }
053}
054
055// End NullValueUdf.java