@Test public void testParseGoodInput() { assertThat( ParboiledRoutingPolicySpecifier.parse("router0"), equalTo(new ParboiledRoutingPolicySpecifier(new NameRoutingPolicyAstNode("router0")))); }
public static ParboiledRoutingPolicySpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.ROUTING_POLICY_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.ROUTING_POLICY_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof RoutingPolicyAstNode, "ParboiledRoutingPolicySpecifier requires an RoutingPolicySpecifier input"); return new ParboiledRoutingPolicySpecifier((RoutingPolicyAstNode) ast); }
ParboiledRoutingPolicySpecifier implements RoutingPolicySpecifier { public static ParboiledRoutingPolicySpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.ROUTING_POLICY_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.ROUTING_POLICY_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof RoutingPolicyAstNode, "ParboiledRoutingPolicySpecifier requires an RoutingPolicySpecifier input"); return new ParboiledRoutingPolicySpecifier((RoutingPolicyAstNode) ast); } }
ParboiledRoutingPolicySpecifier implements RoutingPolicySpecifier { public static ParboiledRoutingPolicySpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.ROUTING_POLICY_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.ROUTING_POLICY_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof RoutingPolicyAstNode, "ParboiledRoutingPolicySpecifier requires an RoutingPolicySpecifier input"); return new ParboiledRoutingPolicySpecifier((RoutingPolicyAstNode) ast); } ParboiledRoutingPolicySpecifier(RoutingPolicyAstNode ast); }
ParboiledRoutingPolicySpecifier implements RoutingPolicySpecifier { public static ParboiledRoutingPolicySpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.ROUTING_POLICY_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.ROUTING_POLICY_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof RoutingPolicyAstNode, "ParboiledRoutingPolicySpecifier requires an RoutingPolicySpecifier input"); return new ParboiledRoutingPolicySpecifier((RoutingPolicyAstNode) ast); } ParboiledRoutingPolicySpecifier(RoutingPolicyAstNode ast); static ParboiledRoutingPolicySpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<RoutingPolicy> resolve(String node, SpecifierContext ctxt); }
ParboiledRoutingPolicySpecifier implements RoutingPolicySpecifier { public static ParboiledRoutingPolicySpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.ROUTING_POLICY_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.ROUTING_POLICY_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof RoutingPolicyAstNode, "ParboiledRoutingPolicySpecifier requires an RoutingPolicySpecifier input"); return new ParboiledRoutingPolicySpecifier((RoutingPolicyAstNode) ast); } ParboiledRoutingPolicySpecifier(RoutingPolicyAstNode ast); static ParboiledRoutingPolicySpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<RoutingPolicy> resolve(String node, SpecifierContext ctxt);  }