Writing a custom analyzer

Declaration analyzer is the part that takes "something" and translates it into declaration objects (see package net.kozelka.args.model)

The class AnnottationAwareSetup implements analyzer which uses Java Reflections with some annottations to construct that model.

The support for custom analyzers may be subject to changes, because there is currently no existing alternative - so, future can show some weak points in the current design.

When to do it

Alternative implementations can be useful when you need to

  • create the declaration model from different input source (XML, DB, ...)
  • define more elegant approach to declaration style
  • reuse existing declaration information in other form

Responsibilities

Analyzer class must implement the ArgsSetup interface, and is responsible for

  • creating the declaration model
  • creating instance of command class - ArgsCommand
  • calling neccessary option methods on that instance