@Override public void initialize(Arguments args) throws DirectiveParseException { this.column = ((ColumnName) args.value("column")).value(); Text algorithm = args.value("algorithm"); if (!MessageHash.isValid(algorithm.value())) { throw new DirectiveParseException( String.format("Algorithm '%s' specified in directive '%s' at line %d is not supported", algorithm, NAME, args.line()) ); } try { this.digest = MessageDigest.getInstance(algorithm.value()); } catch (NoSuchAlgorithmException e) { throw new DirectiveParseException( String.format("Unable to find algorithm specified '%s' in directive '%s' at line %d.", algorithm, NAME, args.line()) ); } this.encode = false; if(args.contains("encode")) { this.encode = ((Bool) args.value("encode")).value(); } }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.column = ((ColumnName) args.value("column")).value(); if (args.contains("sheet")) { this.sheet = ((Text) args.value("sheet")).value(); } else { this.sheet = "0"; } if (args.contains("first-row-as-header")) { this.firstRowAsHeader = ((Boolean) args.value("first-row-as-header").value()); } }
@Override public void initialize(Arguments args) throws DirectiveParseException { toLower = true; if (args.contains("case")) { Identifier identifier = args.value("case"); String casing = identifier.value(); if (casing.equalsIgnoreCase("upper") || casing.equalsIgnoreCase("uppercase")) { toLower = false; } } }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.col = ((ColumnName) args.value("source")).value(); this.delimiter = ((Text) args.value("delimiter")).value(); this.firstColumnName = ((ColumnName) args.value("column1")).value(); this.secondColumnName = ((ColumnName) args.value("column2")).value(); }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.column = ((ColumnName) args.value("column")).value(); if (args.contains("timezone")) { this.timezone = TimeZone.getTimeZone(((Text) args.value("timezone")).value()); } else { this.timezone = TimeZone.getTimeZone("UTC"); } }
@Override public void initialize(Arguments args) throws DirectiveParseException { List<String> cols = ((ColumnNameList) args.value("column")).value(); columns = new String[cols.size()]; columns = cols.toArray(columns); }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.column = ((ColumnName) args.value("column")).value(); this.schemaId = ((Identifier) args.value("schema-id")).value(); this.recordName = ((Text) args.value("record-name")).value(); if(args.contains("version")) { this.version = ((Numeric) args.value("version")).value().intValue(); } else { this.version = -1; } }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.column = ((ColumnName) args.value("column")).value(); this.gson = new Gson(); }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.column = ((ColumnName) args.value("column")).value(); this.timeUnit = TimeUnit.MILLISECONDS; if (args.contains("timeunit")) { String unitValue = ((Text) args.value("timeunit")).value(); this.timeUnit = getTimeUnit(unitValue); } }