Package mondrian.calc
Class ExpCompiler.Factory
- Enclosing interface:
- ExpCompiler
The
ExpCompiler.Factory is used to access
ExpCompiler implementations. Each call returns
a new instance. This factory supports overriding the default
instance by use of a ThreadLocal and by defining a
System property with the ExpCompiler
class name.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTheExpCompileronly has two override mechanisms: theThreadLocalandSystemProperties.Nested classes/interfaces inherited from class mondrian.util.ObjectFactory
ObjectFactory.Singleton<T> -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears the class name (regardless of whether a class name was set).protected StringGet the class name set in theThreadLocalor null.protected ExpCompilergetDefault(Class[] parameterTypes, Object[] parameterValues) TheExpCompiler.Factory's implementation of theObjectFactory's abstract method which returns the defaultExpCompilerinstance.static ExpCompilergetExpCompiler(Evaluator evaluator, Validator validator) Create aExpCompilerinstance, each call returns a new compiler.static ExpCompilergetExpCompiler(Evaluator evaluator, Validator validator, List<ResultStyle> resultStyles) static ExpCompiler.FactoryGet the underlying Factory object.protected org.eigenbase.util.property.StringPropertyReturn theExpCompiler.Factory</code property name.static StringGet the class name of aExpCompilerimplementation or null.Get the current override contect.voidrestoreContext(Object context) Restore the current overrides.static voidsetThreadLocalClassName(String className) Sets the class name of aExpCompilerimplementation.Methods inherited from class mondrian.util.ObjectFactory
getClassName, getObject, getObject, getObject, getObject, getObject
-
Method Details
-
getExpCompiler
public static ExpCompiler getExpCompiler(Evaluator evaluator, Validator validator) throws CreationException Create aExpCompilerinstance, each call returns a new compiler.- Parameters:
evaluator- theEvaluatorto use with the compilervalidator- theValidatorto use with the compiler- Returns:
- the new
ExpCompilercompiler - 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- theEvaluatorto use with the compilervalidator- theValidatorto use with the compilerresultStyles- the initialResultStylearray for the compiler- Returns:
- the new
ExpCompilercompiler - Throws:
CreationException- if the compiler can not be created
-
getThreadLocalClassName
Get the class name of aExpCompilerimplementation or null.- Returns:
- the class name or null.
-
setThreadLocalClassName
Sets the class name of aExpCompilerimplementation. This should be called (obviously) before calling theExpCompiler.FactorygetExpCompilermethod to get theExpCompilerimplementation. 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
Get the class name set in theThreadLocalor null.- Overrides:
getClassNamein classObjectFactory<ExpCompiler>- Returns:
- class name or null.
-
getStringProperty
protected org.eigenbase.util.property.StringProperty getStringProperty()Return theExpCompiler.Factory</code property name.- Specified by:
getStringPropertyin classObjectFactory<ExpCompiler>- Returns:
ExpCompiler.Factoryproperty name
-
getDefault
protected ExpCompiler getDefault(Class[] parameterTypes, Object[] parameterValues) throws CreationException TheExpCompiler.Factory's implementation of theObjectFactory's abstract method which returns the defaultExpCompilerinstance.- Specified by:
getDefaultin classObjectFactory<ExpCompiler>- Parameters:
parameterTypes- array of classes: Evaluator, Validator and ResultStyleparameterValues- the Evaluator, Validator and ResultStyle values- Returns:
ExpCompilerinstance- Throws:
CreationException- if theExpCompilercan not be created.
-
getFactory
Get the underlying Factory object.This is for testing only.
- Returns:
- the
ExpCompiler.Factoryobject
-
removeContext
Get the current override contect.This is for testing only.
- Overrides:
removeContextin classObjectFactory<ExpCompiler>- Returns:
- the override context object.
-
restoreContext
Restore the current overrides.This is for testing only.
- Overrides:
restoreContextin classObjectFactory<ExpCompiler>- Parameters:
context- the current override object.
-