Introduction

This section is dedicated to developer who wish to understand how csvBeans is architectured in order to extend it or just by curiosity.

SpecificationsFileParser

The library needs a configuration file which is called the "specifications". The SpecificationsFileParser class has the responsability to parse this file and produces an in-memory representation of this file into a SpecificationsFile object. Below is the class diagram of SpecificationsFileParser:

The parser uses the Apache Commons Digester package to parse the specifications file. The SpecificationsFile class is a representation of the content in the specifications file. Here is its interface:

Getter methods are provided to extract the information within the specifications.

The parsers

Two interfaces define the csvBeans parsing mechanism:

  • ParsingStrategy
  • LineParser
ParsingStrategy is dedicated to the parsing mechanism for a set of data containing multiple records whereas LineParser is dedicated to parse one line or a set of lines to build one record. Here are their diagrams:

If you need to handle the parsing in a different way of csvBeans, implement one of these interfaces and configure the specifications file to use your implementation.

The builders

The idea is similar to the parsers. Therefore, there are two interfaces dedicated to the builders mechanism:

  • BuildingStrategy
  • LineBuilder
BuildingStrategy is dedicated to build a set of records from a list of beans whereas LineBuilder allows to build one record (that may be composed of one line or a set of lines) from an object. Here are their diagrams:

If you need to handle the building in a different way of csvBeans, implement one of these interfaces and configure the specifications file to use your implementation.