public class DateExtractor extends SimpleFieldExtractor<LocalDate>
LocalDate
based on the specified DateTimeFormatter
.
Returns an empty optional if the date failed to parse.
fieldName, metadataName
Constructor and Description |
---|
DateExtractor(String fieldName,
String metadataName,
DateTimeFormatter formatter)
Deprecated.
|
DateExtractor(String fieldName,
String metadataName,
String dateFormat)
Constructs a date extractor that emits a LocalDate by applying the supplied format to the specified field.
|
Modifier and Type | Method and Description |
---|---|
protected Optional<LocalDate> |
extractField(String s)
Extracts the field value, or returns
Optional.empty() if it failed to parse. |
com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance |
getProvenance() |
Class<LocalDate> |
getValueType()
Gets the class of the value produced by this extractor.
|
void |
postConfig()
Used by the OLCUT configuration system, and should not be called by external code.
|
String |
toString() |
extract, getFieldName, getMetadataName
public DateExtractor(String fieldName, String metadataName, String dateFormat)
fieldName
- The field to read.metadataName
- The metadata field to write.dateFormat
- The date format (supplied to DateTimeFormatter
.@Deprecated public DateExtractor(String fieldName, String metadataName, DateTimeFormatter formatter)
Deprecated as it does not allow recovery of the formatter pattern for the provenance.
fieldName
- The field to read.metadataName
- The metadata field to write.formatter
- The date format (supplied to DateTimeFormatter
.public void postConfig()
postConfig
in interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
in class SimpleFieldExtractor<LocalDate>
public Class<LocalDate> getValueType()
FieldExtractor
protected Optional<LocalDate> extractField(String s)
SimpleFieldExtractor
Optional.empty()
if it failed to parse.extractField
in class SimpleFieldExtractor<LocalDate>
s
- The field value to read.public String toString()
toString
in class SimpleFieldExtractor<LocalDate>
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.