Class DateFormatEvaluator
- java.lang.Object
-
- org.apache.solr.handler.dataimport.Evaluator
-
- org.apache.solr.handler.dataimport.DateFormatEvaluator
-
public class DateFormatEvaluator extends Evaluator
Formats values using a given date format.
Pass three parameters:
- An
EntityField
or a date expression to be parsed with theDateMathParser
class If the value is in a String, then it is assumed to be a datemath expression, otherwise it resolved using aVariableResolver
instance - A date format see
SimpleDateFormat
for the syntax. - The
Locale
to parse. (optional. Defaults to the Root Locale)
- An
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.handler.dataimport.Evaluator
Evaluator.VariableWrapper
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Locale>
availableLocales
protected Set<String>
availableTimezones
static String
DEFAULT_DATE_FORMAT
-
Fields inherited from class org.apache.solr.handler.dataimport.Evaluator
DATE_FORMAT_EVALUATOR, ESCAPE_SOLR_QUERY_CHARS, SQL_ESCAPE_EVALUATOR, URL_ENCODE_EVALUATOR
-
-
Constructor Summary
Constructors Constructor Description DateFormatEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
evaluate(String expression, Context context)
Return a String after processing an expression and aVariableResolver
protected Date
evaluateString(String datemathfmt, Locale locale, TimeZone tz)
NOTE: declared as a method to allow for extensibilityprotected Date
evaluateWrapper(Evaluator.VariableWrapper variableWrapper, Locale locale, TimeZone tz)
NOTE: declared as a method to allow for extensibilityprotected Object
resolveWrapper(Evaluator.VariableWrapper variableWrapper, Locale locale, TimeZone tz)
NOTE: declared as a method to allow for extensibility-
Methods inherited from class org.apache.solr.handler.dataimport.Evaluator
getVariableWrapper, parseParams
-
-
-
-
Method Detail
-
evaluate
public String evaluate(String expression, Context context)
Description copied from class:Evaluator
Return a String after processing an expression and aVariableResolver
- Specified by:
evaluate
in classEvaluator
- Parameters:
expression
- string to be evaluatedcontext
- instance- Returns:
- the value of the given expression evaluated using the resolver
- See Also:
VariableResolver
-
evaluateWrapper
protected Date evaluateWrapper(Evaluator.VariableWrapper variableWrapper, Locale locale, TimeZone tz)
NOTE: declared as a method to allow for extensibility- Returns:
- the result of evaluating a string
- WARNING: This API is experimental and might change in incompatible ways in the next release.
- this API is experimental and subject to change
-
evaluateString
protected Date evaluateString(String datemathfmt, Locale locale, TimeZone tz)
NOTE: declared as a method to allow for extensibility- Returns:
- the result of evaluating a string
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
resolveWrapper
protected Object resolveWrapper(Evaluator.VariableWrapper variableWrapper, Locale locale, TimeZone tz)
NOTE: declared as a method to allow for extensibility- Returns:
- the result of resolving the variable wrapper
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-