Project Tokyo – q·.:framework encoder class diagram

The encoder package of the q·.:framework is handles the generation of the different contact card formats (vCard q·.:Card, meCard) and the encoding of contact information into a QR Code. We’ve finished a first version of the implementation for generating and encoding of the meCard and q·.:card formats (see classdiagram for an overview encoder package).

Transformer classes are responsible for translating the raw user information data into a format-specific format. Currently, we support there are three kinds of formats, each implemented by as separate Transformer class, derived from a generalized Transformer class (which is useful for factory patterns). All Transformers implement the IDataTransformer interface.
The Transformers return an instance of the Encoder class, which is a pixel based representation of the encoded contact information. The pixelmap is in turn used to draw the 2d QR-Code image on the screen.

The TransformationModule Class acts as the “glue”  between the Transformer implementations and the Encoder. It works with dependency injection by making use of the lightweight google guice framework. Future extensions with a new format, require this class to “register” the new format.

The Transformer classes interacts with Bean Objects, containing user specific data, which are collected by the q·.:card android app (as shown here). The attributes may change in future because of new user requirements. Thus, it is possible to tell the q·.:framework which attributes are required, and which are not. Required attributes must have a value, otherwise an exception will be thrown by the framework. For this purpose the q·.:framework provides a special marker annotation called Required. Consequently, each field in a Bean which has the @Required annotation, must have a value! To check this, there is a method called validate() in the CardFormat class which works with reflection and takes a look at the various fields of the bean. :) nice, eh?!?

This was a quick overview of the Encoder part of the q·.:framework. In one of the next posts we will take a look at the Decoding part of the framework which will play the game in reversed direction. Parsing and decoding of scanned QR-Codes :-) .

bernd, member of the project tokyo team

, , ,
  • Delicious
  • Facebook
  • Digg
  • Reddit
  • StumbleUpon
  • Twitter

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>