Class DBEvalContext
- java.lang.Object
-
- com.healthmarketscience.jackcess.impl.DBEvalContext
-
- All Implemented Interfaces:
EvalConfig,LocaleContext,Expressionator.ParseContext
public class DBEvalContext extends Object implements Expressionator.ParseContext, EvalConfig
- Author:
- James Ahlborn
-
-
Constructor Summary
Constructors Constructor Description DBEvalContext(DatabaseImpl db)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateTimeFormattercreateDateFormatter(String formatStr)DecimalFormatcreateDecimalFormat(String formatStr)BindingsgetBindings()FunctionLookupgetFunctionLookup()LocalegetLocale()NumericConfiggetNumericConfig()floatgetRandom(Integer seed)TemporalConfiggetTemporalConfig()ZoneIdgetZoneId()voidsetBindings(Bindings bindings)Allows for passing custom information into expression evaluation.voidsetFunctionLookup(FunctionLookup lookup)Sets theFunctionprovider to use during expression evaluation.voidsetLocale(Locale locale)Sets the Locale for use when evaluating expressions.voidsetNumericConfig(NumericConfig numeric)Sets the NumericConfig for use when evaluating expressions.voidsetTemporalConfig(TemporalConfig temporal)Sets the TemporalConfig for use when evaluating expressions.
-
-
-
Constructor Detail
-
DBEvalContext
public DBEvalContext(DatabaseImpl db)
-
-
Method Detail
-
getLocale
public Locale getLocale()
- Specified by:
getLocalein interfaceEvalConfig- Specified by:
getLocalein interfaceLocaleContext- Returns:
- the currently configured Locale
-
setLocale
public void setLocale(Locale locale)
Description copied from interface:EvalConfigSets the Locale for use when evaluating expressions. The default locale isLocale.US, so this may need to be modified when interacting withDatabaseinstances from other locales.- Specified by:
setLocalein interfaceEvalConfig
-
getTemporalConfig
public TemporalConfig getTemporalConfig()
- Specified by:
getTemporalConfigin interfaceEvalConfig- Specified by:
getTemporalConfigin interfaceLocaleContext- Returns:
- the currently configured TemporalConfig (from the
EvalConfig)
-
setTemporalConfig
public void setTemporalConfig(TemporalConfig temporal)
Description copied from interface:EvalConfigSets the TemporalConfig for use when evaluating expressions. The default date/time formatting is US based, so this may need to be modified when interacting withDatabaseinstances from other locales.- Specified by:
setTemporalConfigin interfaceEvalConfig
-
getZoneId
public ZoneId getZoneId()
- Specified by:
getZoneIdin interfaceLocaleContext- Returns:
- the currently configured ZoneId
-
getNumericConfig
public NumericConfig getNumericConfig()
- Specified by:
getNumericConfigin interfaceEvalConfig- Specified by:
getNumericConfigin interfaceLocaleContext- Returns:
- the currently configured NumericConfig (from the
EvalConfig)
-
setNumericConfig
public void setNumericConfig(NumericConfig numeric)
Description copied from interface:EvalConfigSets the NumericConfig for use when evaluating expressions. The default date/time formatting is US based, so this may need to be modified when interacting withDatabaseinstances from other locales.- Specified by:
setNumericConfigin interfaceEvalConfig
-
getFunctionLookup
public FunctionLookup getFunctionLookup()
- Specified by:
getFunctionLookupin interfaceEvalConfig- Specified by:
getFunctionLookupin interfaceExpressionator.ParseContext- Returns:
- the currently configured FunctionLookup
-
setFunctionLookup
public void setFunctionLookup(FunctionLookup lookup)
Description copied from interface:EvalConfigSets theFunctionprovider to use during expression evaluation. The Functions supported by the default FunctionLookup are documented incom.healthmarketscience.jackcess.expr. Custom Functions can be implemented and provided to the expression evaluation engine by installing a custom FunctionLookup instance (which would presumably wrap and delegate to the default FunctionLookup instance for any default implementations).- Specified by:
setFunctionLookupin interfaceEvalConfig
-
getBindings
public Bindings getBindings()
- Specified by:
getBindingsin interfaceEvalConfig- Returns:
- the currently configured Bindings
-
setBindings
public void setBindings(Bindings bindings)
Description copied from interface:EvalConfigAllows for passing custom information into expression evaluation. Currently, none of the default implementations make use of the Bindings. However, in the future, customization parameters could potentially be supported via custom Bindings. Additionally, custom Function instances could be passed external information via custom Bindings.- Specified by:
setBindingsin interfaceEvalConfig
-
createDateFormatter
public DateTimeFormatter createDateFormatter(String formatStr)
- Specified by:
createDateFormatterin interfaceLocaleContext- Returns:
- an appropriately configured (i.e. locale) DateTimeFormatter for the given format.
-
createDecimalFormat
public DecimalFormat createDecimalFormat(String formatStr)
- Specified by:
createDecimalFormatin interfaceLocaleContext- Returns:
- an appropriately configured (i.e. DecimalFormatSymbols) DecimalFormat for the given format.
-
getRandom
public float getRandom(Integer seed)
-
-