Class DateExtractor
java.lang.Object
org.tribuo.data.columnar.extractors.SimpleFieldExtractor<LocalDate>
org.tribuo.data.columnar.extractors.DateExtractor
- 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<LocalDate>
Extracts the field value and translates it to a
LocalDate
based on the specified DateTimeFormatter
.
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
ConstructorsConstructorDescriptionDateExtractor
(String fieldName, String metadataName, String dateFormat) Constructs a date extractor that emits a LocalDate by applying the supplied format to the specified field.DateExtractor
(String fieldName, String metadataName, DateTimeFormatter formatter) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionExtracts 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
-
DateExtractor
Constructs a date extractor that emits a LocalDate by applying the supplied format to the specified field.- Parameters:
fieldName
- The field to read.metadataName
- The metadata field to write.dateFormat
- The date format (supplied toDateTimeFormatter
.
-
DateExtractor
@Deprecated public DateExtractor(String fieldName, String metadataName, DateTimeFormatter formatter) Deprecated.Constructs a date extractor that emits a LocalDate by applying the supplied format to the specified field.Deprecated as it does not allow recovery of the formatter pattern for the provenance.
- Parameters:
fieldName
- The field to read.metadataName
- The metadata field to write.formatter
- The date format (supplied toDateTimeFormatter
.
-
-
Method Details
-
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<LocalDate>
-
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<LocalDate>
- Parameters:
s
- The field value to read.- Returns:
- The extracted value.
-
toString
- Overrides:
toString
in classSimpleFieldExtractor<LocalDate>
-
getProvenance
-