Class OffsetDateTimeExtractor
java.lang.Object
org.tribuo.data.columnar.extractors.SimpleFieldExtractor<OffsetDateTime>
org.tribuo.data.columnar.extractors.OffsetDateTimeExtractor
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,FieldExtractor<OffsetDateTime>
Extracts the field value and translates it to an
OffsetDateTime
based on the specified DateTimeFormatter
.
The formatter is supplied as a String to ensure it is tracked properly in the provenance.
Returns an empty optional if the date failed to parse.
-
Field Summary
Fields inherited from class org.tribuo.data.columnar.extractors.SimpleFieldExtractor
fieldName, metadataName
-
Constructor Summary
ConstructorDescriptionOffsetDateTimeExtractor
(String fieldName, String metadataName, String dateTimeFormat) Constructs a date time extractor that emits an OffsetDateTime by applying the supplied format to the specified field.OffsetDateTimeExtractor
(String fieldName, String metadataName, String dateTimeFormat, String localeLanguage, String localeCountry) Constructs a date time extractor that emits an OffsetDateTime by applying the supplied format to the specified field. -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<OffsetDateTime>
Extracts the field value, or returnsOptional.empty()
if it failed to parse.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
Gets the class of the value produced by this extractor.void
Used by the OLCUT configuration system, and should not be called by external code.toString()
Methods inherited from class org.tribuo.data.columnar.extractors.SimpleFieldExtractor
extract, getFieldName, getMetadataName
-
Constructor Details
-
OffsetDateTimeExtractor
Constructs a date time extractor that emits an OffsetDateTime by applying the supplied format to the specified field.Uses the system locale for backwards compatibility with 4.0 and 4.1.
- Parameters:
fieldName
- The field to read.metadataName
- The metadata field to write.dateTimeFormat
- The date/time format (supplied toDateTimeFormatter
.
-
OffsetDateTimeExtractor
public OffsetDateTimeExtractor(String fieldName, String metadataName, String dateTimeFormat, String localeLanguage, String localeCountry) Constructs a date time extractor that emits an OffsetDateTime by applying the supplied format to the specified field.- Parameters:
fieldName
- The field to read.metadataName
- The metadata field to write to.dateTimeFormat
- The date format (supplied toDateTimeFormatter
.localeLanguage
- The locale language.localeCountry
- The locale country.
-
-
Method Details
-
postConfig
public void postConfig()Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfig
in interfacecom.oracle.labs.mlrg.olcut.config.Configurable
- Overrides:
postConfig
in classSimpleFieldExtractor<OffsetDateTime>
-
getValueType
Description copied from interface:FieldExtractor
Gets the class of the value produced by this extractor.- Returns:
- The class of the value.
-
extractField
Description copied from class:SimpleFieldExtractor
Extracts the field value, or returnsOptional.empty()
if it failed to parse.- Specified by:
extractField
in classSimpleFieldExtractor<OffsetDateTime>
- Parameters:
s
- The field value to read.- Returns:
- The extracted value.
-
toString
- Overrides:
toString
in classSimpleFieldExtractor<OffsetDateTime>
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
-