Class DateTimeConverter
- java.lang.Object
-
- com.ezylang.evalex.data.conversion.DateTimeConverter
-
- All Implemented Interfaces:
ConverterIfc
public class DateTimeConverter extends java.lang.Object implements ConverterIfc
Converter to convert to the DATE_TIME data type.
-
-
Constructor Summary
Constructors Constructor Description DateTimeConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanConvert(java.lang.Object object)Checks, if a given object can be converted by this converter.EvaluationValueconvert(java.lang.Object object, ExpressionConfiguration configuration)Called to convert a previously checked data type.java.time.InstantparseDateTime(java.lang.String value, java.time.ZoneId zoneId, java.util.List<java.time.format.DateTimeFormatter> formatters)Tries to parse a date-time string by trying out each format in the list.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ezylang.evalex.data.conversion.ConverterIfc
illegalArgument
-
-
-
-
Method Detail
-
convert
public EvaluationValue convert(java.lang.Object object, ExpressionConfiguration configuration)
Description copied from interface:ConverterIfcCalled to convert a previously checked data type.- Specified by:
convertin interfaceConverterIfc- Parameters:
object- The object to convert.configuration- The current expression configuration.- Returns:
- The converted value.
-
parseDateTime
public java.time.Instant parseDateTime(java.lang.String value, java.time.ZoneId zoneId, java.util.List<java.time.format.DateTimeFormatter> formatters)Tries to parse a date-time string by trying out each format in the list. The first matching result is returned. If none of the formats can be used to parse the string,nullis returned.- Parameters:
value- The string to parse.zoneId- TheZoneIdto use for parsing.formatters- The list of formatters.- Returns:
- A parsed
Instantif parsing was successful, elsenull.
-
canConvert
public boolean canConvert(java.lang.Object object)
Description copied from interface:ConverterIfcChecks, if a given object can be converted by this converter.- Specified by:
canConvertin interfaceConverterIfc- Parameters:
object- The object to convert.- Returns:
trueif the object can be converted, false otherwise.
-
-