Package mondrian.calc
Class ExpCompiler.Factory
- java.lang.Object
-
- mondrian.util.ObjectFactory<ExpCompiler>
-
- mondrian.calc.ExpCompiler.Factory
-
- Enclosing interface:
- ExpCompiler
public static final class ExpCompiler.Factory extends ObjectFactory<ExpCompiler>
TheExpCompiler.Factory
is used to accessExpCompiler
implementations. Each call returns a new instance. This factory supports overriding the default instance by use of aThreadLocal
and by defining aSystem
property with theExpCompiler
class name.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExpCompiler.Factory.Context
TheExpCompiler
only has two override mechanisms: theThreadLocal
andSystem
Properties
.-
Nested classes/interfaces inherited from class mondrian.util.ObjectFactory
ObjectFactory.Singleton<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clearThreadLocalClassName()
Clears the class name (regardless of whether a class name was set).protected String
getClassName()
Get the class name set in theThreadLocal
or null.protected ExpCompiler
getDefault(Class[] parameterTypes, Object[] parameterValues)
TheExpCompiler.Factory
's implementation of theObjectFactory
's abstract method which returns the defaultExpCompiler
instance.static ExpCompiler
getExpCompiler(Evaluator evaluator, Validator validator)
Create aExpCompiler
instance, each call returns a new compiler.static ExpCompiler
getExpCompiler(Evaluator evaluator, Validator validator, List<ResultStyle> resultStyles)
static ExpCompiler.Factory
getFactory()
Get the underlying Factory object.protected org.eigenbase.util.property.StringProperty
getStringProperty()
Return theExpCompiler.Factory
static String
getThreadLocalClassName()
Get the class name of aExpCompiler
implementation or null.Object
removeContext()
Get the current override contect.void
restoreContext(Object context)
Restore the current overrides.static void
setThreadLocalClassName(String className)
Sets the class name of aExpCompiler
implementation.-
Methods inherited from class mondrian.util.ObjectFactory
getClassName, getObject, getObject, getObject, getObject, getObject
-
-
-
-
Method Detail
-
getExpCompiler
public static ExpCompiler getExpCompiler(Evaluator evaluator, Validator validator) throws CreationException
Create aExpCompiler
instance, each call returns a new compiler.- Parameters:
evaluator
- theEvaluator
to use with the compilervalidator
- theValidator
to use with the compiler- Returns:
- the new
ExpCompiler
compiler - Throws:
CreationException
- if the compiler can not be created
-
getExpCompiler
public static ExpCompiler getExpCompiler(Evaluator evaluator, Validator validator, List<ResultStyle> resultStyles) throws CreationException
- Parameters:
evaluator
- theEvaluator
to use with the compilervalidator
- theValidator
to use with the compilerresultStyles
- the initialResultStyle
array for the compiler- Returns:
- the new
ExpCompiler
compiler - Throws:
CreationException
- if the compiler can not be created
-
getThreadLocalClassName
public static String getThreadLocalClassName()
Get the class name of aExpCompiler
implementation or null.- Returns:
- the class name or null.
-
setThreadLocalClassName
public static void setThreadLocalClassName(String className)
Sets the class name of aExpCompiler
implementation. This should be called (obviously) before calling theExpCompiler.Factory
getExpCompiler
method to get theExpCompiler
implementation. Generally, this is only used for testing.- Parameters:
className
- Class name
-
clearThreadLocalClassName
public static void clearThreadLocalClassName()
Clears the class name (regardless of whether a class name was set). When a class name is set usingsetThreadLocalClassName
, the setting whould be done in a try-block and a call to this clear method should be in the finally-clause of that try-block.
-
getClassName
protected String getClassName()
Get the class name set in theThreadLocal
or null.- Overrides:
getClassName
in classObjectFactory<ExpCompiler>
- Returns:
- class name or null.
-
getStringProperty
protected org.eigenbase.util.property.StringProperty getStringProperty()
Return theExpCompiler.Factory
- Specified by:
getStringProperty
in classObjectFactory<ExpCompiler>
- Returns:
ExpCompiler.Factory
property name
-
getDefault
protected ExpCompiler getDefault(Class[] parameterTypes, Object[] parameterValues) throws CreationException
TheExpCompiler.Factory
's implementation of theObjectFactory
's abstract method which returns the defaultExpCompiler
instance.- Specified by:
getDefault
in classObjectFactory<ExpCompiler>
- Parameters:
parameterTypes
- array of classes: Evaluator, Validator and ResultStyleparameterValues
- the Evaluator, Validator and ResultStyle values- Returns:
ExpCompiler
instance- Throws:
CreationException
- if theExpCompiler
can not be created.
-
getFactory
public static ExpCompiler.Factory getFactory()
Get the underlying Factory object.This is for testing only.
- Returns:
- the
ExpCompiler.Factory
object
-
removeContext
public Object removeContext()
Get the current override contect.This is for testing only.
- Overrides:
removeContext
in classObjectFactory<ExpCompiler>
- Returns:
- the override context object.
-
restoreContext
public void restoreContext(Object context)
Restore the current overrides.This is for testing only.
- Overrides:
restoreContext
in classObjectFactory<ExpCompiler>
- Parameters:
context
- the current override object.
-
-