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>

public class DateExtractor extends SimpleFieldExtractor<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.

  • Constructor Details

    • DateExtractor

      public DateExtractor(String fieldName, String metadataName, String dateFormat)
      Constructs a date extractor that emits a LocalDate 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.
      dateFormat - The date format (supplied to DateTimeFormatter.
    • DateExtractor

      public DateExtractor(String fieldName, String metadataName, String dateFormat, String localeLanguage, String localeCountry)
      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 to.
      dateFormat - The date format (supplied to DateTimeFormatter.
      localeLanguage - The locale language.
      localeCountry - The locale country.
    • 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.

      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.
      formatter - The date format (supplied to DateTimeFormatter.
  • Method Details