Package mondrian.olap
Interface Validator
-
public interface ValidatorProvides context necessary to resolve identifiers to objects, function calls to specific functions.An expression calls
validate(mondrian.olap.Exp, boolean)on each of its children, which in turn callsExp.accept(mondrian.olap.Validator).- Author:
- jhyde
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanalwaysResolveFunDef()Whether to resolve function name and arguments to a function definition each time a node is validated, not just the first time.booleancanConvert(int ordinal, Exp fromExp, int to, List<Resolver.Conversion> conversions)Returns whether we can convert an argument to a parameter type.ParametercreateOrLookupParam(boolean definition, String name, Type type, Exp defaultExp, String description)Creates or retrieves the parameter corresponding to a "Parameter" or "ParamRef" function call.FunDefgetDef(Exp[] args, String name, Syntax syntax)Resolves a function call to a particular function.FunTablegetFunTable()Returns the table of function and operator definitions.QuerygetQuery()Returns theQuerywhich is being validated.SchemaReadergetSchemaReader()Returns the schema reader with which to resolve names of MDX objects (dimensions, hierarchies, levels, members, named sets).booleanrequiresExpression()Returns whether the current context requires an expression.voidvalidate(ParameterExpr parameterExpr)Validates a usage of a parameter.Expvalidate(Exp exp, boolean scalar)Validates an expression, and returns the expression it resolves to.voidvalidate(Formula formula)Validates a formula.voidvalidate(MemberProperty memberProperty)Validates a child member property.voidvalidate(QueryAxis axis)Validates an axis.
-
-
-
Method Detail
-
validate
Exp validate(Exp exp, boolean scalar)
Validates an expression, and returns the expression it resolves to.- Parameters:
exp- Expression to validatescalar- Whether the context requires that the expression is evaluated to a value, as opposed to a tuple
-
validate
void validate(ParameterExpr parameterExpr)
Validates a usage of a parameter.It must resolve to the same object (although sub-objects may change).
-
validate
void validate(MemberProperty memberProperty)
Validates a child member property.It must resolve to the same object (although sub-objects may change).
-
validate
void validate(QueryAxis axis)
Validates an axis. It must resolve to the same object (although sub-objects may change).
-
validate
void validate(Formula formula)
Validates a formula. It must resolve to the same object (although sub-objects may change).
-
requiresExpression
boolean requiresExpression()
Returns whether the current context requires an expression.
-
canConvert
boolean canConvert(int ordinal, Exp fromExp, int to, List<Resolver.Conversion> conversions)Returns whether we can convert an argument to a parameter type.- Parameters:
ordinal- argument ordinalfromExp- argument typeto- parameter typeconversions- List of conversions performed; method adds an element for each non-trivial conversion (for example, converting a member to a level).- Returns:
- Whether we can convert an argument to a parameter type
-
getFunTable
FunTable getFunTable()
Returns the table of function and operator definitions.
-
createOrLookupParam
Parameter createOrLookupParam(boolean definition, String name, Type type, Exp defaultExp, String description)
Creates or retrieves the parameter corresponding to a "Parameter" or "ParamRef" function call.
-
getDef
FunDef getDef(Exp[] args, String name, Syntax syntax)
Resolves a function call to a particular function. If the function is overloaded, returns as precise a match to the argument types as possible.
-
alwaysResolveFunDef
boolean alwaysResolveFunDef()
Whether to resolve function name and arguments to a function definition each time a node is validated, not just the first time.Default implementation returns
false.- Returns:
- whether to resolve function each time
-
getSchemaReader
SchemaReader getSchemaReader()
Returns the schema reader with which to resolve names of MDX objects (dimensions, hierarchies, levels, members, named sets).The schema reader is initially in the context of the query's cube, and during a traversal it may change if named sets are introduced using the 'expr AS alias' construct.
- Returns:
- Schema reader
-
-