@Test public void testOneRecord() throws SyntaxError { String dsl = "ENTITY ONEREC SingleRecord {" + " TEXT code " + " NUMBER value" + " }"; StringReader reader = new StringReader(dsl); RawSchema rawSchema = SchemaParser.parse(reader); Map<String, RawEntity> rawEntitiesByName = rawSchema.getRawEntitiesByName(); RawEntity singleRecord = rawEntitiesByName.get("SINGLERECORD"); assertTrue(singleRecord.isOneRecord()); }
private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } private  SchemaParser(Reader r); }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } private  SchemaParser(Reader r); static RawSchema parse(Reader r); }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } private  SchemaParser(Reader r); static RawSchema parse(Reader r);  }