5.5. Coffee Assemblers

The coffee grammar suggests the need for six assemblers, which define actions to take upon seeing a name, a former name, a roast, the /French qualifier, the country, and the price. Figure 5.2 shows the assemblers and other classes in the coffee package.

Figure 5.2. The coffee package. This package contains classes that collaborate to create a Coffee object from text.

Figure 5.3 shows where the assemblers plug in to the subparsers of the CoffeeParser class.

Figure 5.3. Coffee assembler placement. This table shows the assembler that each coffee subparser employs.

5.5.1. Coffee Assembler Code

The NameAssembler class is typical ...

Get Building Parsers with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.