Hi Shen,
you can extend PipelineOptions like this:
private interface Options extends PipelineOptions {
String GDELT_EVENTS_URL = "http://data.gdeltproject.org/events/";
@Description("GDELT file date")
@Default.InstanceFactory(GDELTFileFactory.class)
String getDate();
void setDate(String value);
@Description("Input Path")
String getInput();
void setInput(String value);
@Description("Output Path")
String getOutput();
void setOutput(String value);
class GDELTFileFactory implements DefaultValueFactory<String> {
public String create(PipelineOptions options) {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
return format.format(new Date());
}
}
}
and then:
Options options =
PipelineOptionsFactory.fromArgs(args).withValidation().as(Options.class);
Regards
JB
On 09/02/2016 03:21 PM, Shen Li wrote:
Hi,
I am trying to understand how can I extend PipelineOptions to add getters
and setters with my custom type. The document in PiplineOptionsFactory says
"JSON format is required for all other types". If I want to use
java.util.logging.Level in a getter and a setter, what JSON string should I
pass in the command line?
Thanks,
Shen
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com