public class DateFormatEvaluator extends Evaluator
Formats values using a given date format.
Pass three parameters:
EntityField
or a date expression to be parsed with
the DateMathParser
class If the value is in a String,
then it is assumed to be a datemath expression, otherwise it
resolved using a VariableResolver
instanceSimpleDateFormat
for the syntax.Locale
to parse.
(optional. Defaults to the Root Locale) Evaluator.VariableWrapper
Modifier and Type | Field and Description |
---|---|
protected Map<String,Locale> |
availableLocales |
protected Set<String> |
availableTimezones |
static String |
DEFAULT_DATE_FORMAT |
DATE_FORMAT_EVALUATOR, ESCAPE_SOLR_QUERY_CHARS, SQL_ESCAPE_EVALUATOR, URL_ENCODE_EVALUATOR
Constructor and Description |
---|
DateFormatEvaluator() |
Modifier and Type | Method and Description |
---|---|
String |
evaluate(String expression,
Context context)
Return a String after processing an expression and a
VariableResolver |
protected Date |
evaluateString(String datemathfmt,
Locale locale,
TimeZone tz)
NOTE: declared as a method to allow for extensibility
|
protected Date |
evaluateWrapper(Evaluator.VariableWrapper variableWrapper,
Locale locale,
TimeZone tz)
NOTE: declared as a method to allow for extensibility
|
protected Object |
resolveWrapper(Evaluator.VariableWrapper variableWrapper,
Locale locale,
TimeZone tz)
NOTE: declared as a method to allow for extensibility
|
getVariableWrapper, parseParams
public static final String DEFAULT_DATE_FORMAT
public String evaluate(String expression, Context context)
Evaluator
VariableResolver
evaluate
in class Evaluator
expression
- string to be evaluatedcontext
- instanceVariableResolver
protected Date evaluateWrapper(Evaluator.VariableWrapper variableWrapper, Locale locale, TimeZone tz)
protected Date evaluateString(String datemathfmt, Locale locale, TimeZone tz)
protected Object resolveWrapper(Evaluator.VariableWrapper variableWrapper, Locale locale, TimeZone tz)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.