/** * A Directive can include identifiers, this method extracts that token that is being * identified as token of type <code>Identifier</code>. */ @Override public RecipeSymbol.Builder visitIdentifier(DirectivesParser.IdentifierContext ctx) { builder.addToken(new Identifier(ctx.Identifier().getText())); return super.visitIdentifier(ctx); }
@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 { String matchType = ((Identifier) args.value("match-type")).value(); if (matchType.equalsIgnoreCase("if-matched")) { matched = true; } else if (matchType.equalsIgnoreCase("if-not-matched")) { matched = false; } else { throw new DirectiveParseException("Match type specified is not 'if-matched' or 'if-not-matched'"); } column = ((ColumnName) args.value("column")).value(); String regex = ((Text) args.value("regex")).value(); if (!regex.equalsIgnoreCase("null") && !regex.isEmpty()) { pattern = Pattern.compile(regex); } else { pattern = null; } }
@Override public void initialize(Arguments args) throws DirectiveParseException { col = ((ColumnName)args.value("column")).value(); type = ((Identifier)args.value("type")).value(); }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.column = ((ColumnName) args.value("column")).value(); this.schemaId = ((Identifier) args.value("schema-id")).value(); this.type = ((Identifier) args.value("encode-type")).value(); if (!"json".equalsIgnoreCase(type) && !"binary".equalsIgnoreCase(type)) { throw new DirectiveParseException( String.format("Parsing AVRO can be either of type 'json' or 'binary'") ); } 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.variable = ((Identifier) args.value("variable")).value(); this.expression = ((Expression) args.value("condition")).value(); try { el.compile(expression); } catch (ELException e) { throw new DirectiveParseException(e.getMessage()); } }
@Override public void initialize(Arguments args) throws DirectiveParseException { condition = ((Expression) args.value("condition")).value(); try { el.compile(condition); } catch (ELException e) { throw new DirectiveParseException( String.format("Invalid condition '%s'.", condition) ); } if (args.contains("metric")) { metric = ((Identifier) args.value("metric")).value(); } if (args.contains("message")) { message = ((Text) args.value("message")).value(); } }
@Override public void initialize(Arguments args) throws DirectiveParseException { condition = ((Expression) args.value("condition")).value(); try { el.compile(condition); } catch (ELException e) { throw new DirectiveParseException( String.format("Invalid condition '%s'.", condition) ); } if (args.contains("metric")) { metric = ((Identifier) args.value("metric")).value(); } if (args.contains("message")) { message = ((Text) args.value("message")).value(); } }
@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.variable = ((Identifier) args.value("variable")).value(); this.expression = ((Expression) args.value("condition")).value(); this.incrementBy = ((Numeric) args.value("value")).value().longValue(); try { el.compile(expression); } catch (ELException e) { throw new DirectiveParseException(e.getMessage()); } }