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) Modifier and Type | Class and Description |
---|---|
protected static class |
DateFormatEvaluator.DateFormatCacheKey
Used to wrap cache keys containing a Locale, TimeZone and date format String
|
Evaluator.VariableWrapper
Modifier and Type | Field and Description |
---|---|
protected Map<String,Locale> |
availableLocales |
protected Set<String> |
availableTimezones |
protected Map<DateFormatEvaluator.DateFormatCacheKey,SimpleDateFormat> |
cache |
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 DateMathParser |
getDateMathParser(Locale l,
TimeZone tz) |
protected Date |
parseMathString(DateMathParser parser,
String datemathfmt)
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
protected Map<DateFormatEvaluator.DateFormatCacheKey,SimpleDateFormat> cache
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 Date parseMathString(DateMathParser parser, String datemathfmt) throws ParseException
ParseException
protected Object resolveWrapper(Evaluator.VariableWrapper variableWrapper, Locale locale, TimeZone tz)
protected DateMathParser getDateMathParser(Locale l, TimeZone tz)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.