public abstract class SimpleFieldExtractor<T> extends Object implements FieldExtractor<T>
Example
's metadata field.Modifier and Type | Field and Description |
---|---|
protected String |
fieldName |
protected String |
metadataName |
Modifier | Constructor and Description |
---|---|
protected |
SimpleFieldExtractor()
For olcut.
|
protected |
SimpleFieldExtractor(String fieldName)
Constructs a simple field extractor which reads from the supplied field name and
writes out to a metadata field with the same name.
|
protected |
SimpleFieldExtractor(String fieldName,
String metadataName)
Constructs a simple field extractor with the supplied field name and metadata field name.
|
Modifier and Type | Method and Description |
---|---|
Optional<T> |
extract(ColumnarIterator.Row row)
Returns Optional which is filled if extraction succeeded.
|
protected abstract Optional<T> |
extractField(String fieldValue)
Extracts the field value, or returns
Optional.empty() if it failed to parse. |
String |
getFieldName()
Gets the field name this extractor operates on.
|
String |
getMetadataName()
Gets the metadata key name.
|
void |
postConfig()
Used by the OLCUT configuration system, and should not be called by external code.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getValueType
@Config(mandatory=true, description="The field name to read.") protected String fieldName
@Config(description="The metadata key to emit, defaults to field name if unpopulated") protected String metadataName
protected SimpleFieldExtractor(String fieldName)
fieldName
- The field name to read from.protected SimpleFieldExtractor(String fieldName, String metadataName)
fieldName
- The field name to read.metadataName
- The metadata field name to write to.protected SimpleFieldExtractor()
public void postConfig()
postConfig
in interface com.oracle.labs.mlrg.olcut.config.Configurable
public String getFieldName()
public String getMetadataName()
Example
if it is given to RowProcessor
.
Defaults to the field name.
getMetadataName
in interface FieldExtractor<T>
protected abstract Optional<T> extractField(String fieldValue)
Optional.empty()
if it failed to parse.fieldValue
- The field value to read.public Optional<T> extract(ColumnarIterator.Row row)
FieldExtractor
extract
in interface FieldExtractor<T>
row
- The raw row from which to extract a valueCopyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.