001    /*
002    // $Id: //open/mondrian/src/main/mondrian/olap/Parameter.java#25 $
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) 2006-2006 Julian Hyde
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.olap;
011    
012    import mondrian.olap.type.Type;
013    
014    /**
015     * Parameter to a Query.
016     *
017     * <p>A parameter is not an expression; see {@link mondrian.mdx.ParameterExpr}.
018     *
019     * @author jhyde
020     * @version $Id: //open/mondrian/src/main/mondrian/olap/Parameter.java#25 $
021     * @since Jul 22, 2006
022     */
023    public interface Parameter {
024        /**
025         * Returns the scope where this parmater is defined.
026         */
027        Scope getScope();
028    
029        /**
030         * Returns the type of this Parameter.
031         */
032        Type getType();
033    
034        /**
035         * Returns the expression which provides the default value for this
036         * Parameter. Never null.
037         */
038        Exp getDefaultExp();
039    
040        /**
041         * Returns the name of this Parameter.
042         */
043        String getName();
044    
045        /**
046         * Returns the description of this Parameter.
047         */
048        String getDescription();
049    
050        /**
051         * Returns whether the value of this Parameter can be modified in a query.
052         */
053        boolean isModifiable();
054    
055        /**
056         * Returns the value of this parameter. If {@link #setValue(Object)} has
057         * not been called, and the parameter still has its default value, returns
058         * null.
059         *
060         * <p>The type of the value is (depending on the type of the parameter)
061         * a {@link String}, {@link Number}, or {@link Member}.
062         */
063        Object getValue();
064    
065        /**
066         * Sets the value of this parameter.
067         *
068         * @param value Value of the parameter; must be a {@link String},
069         *   a {@link Double}, or a {@link mondrian.olap.Member}
070         */
071        void setValue(Object value);
072    
073        /**
074         * Scope where a parameter is defined.
075         */
076        enum Scope {
077            System,
078            Schema,
079            Connection,
080            Statement
081        }
082    }
083    
084    // End Parameter.java