O'Reilly logo

Building Parsers with Java™ by Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required