The steps performed in analyzing an instance variable

The VariableLyrinx.process() method is invoked by the ClassLyrinx. This method has as goal to create an instance of the class and to initialize its attributes with values such as Javadocs, type, name, etc.

These the steps performed by the VariableLyrinx.process() method:

  • For the reasons already seen for classes and methods, this method narrows down the instance of object to the type
  • The method then proceeds in determining the variable type. There are substantially three instance variable types: instance variables of object type; instance variables of primitive datatypes, and instance variables of an inner class type. The Java compiler returns three different types of Tree objects, one for each variable type. Once the method has determined the instance variable type, this information is set as attribute in the Variable object after one has been created thanks to the ComponentManufactory class.
  • The method then sets the variable name.
  • If the variable was initialized, the method sets this information in the Variable class, as attribute.
  • The method then, similarly to what was done for classes and methods (and more generally for every component) adds the Variable object in the registry maintained by the Amplimet.
  • The method then retrieves the Javadoc comments for this variable from the ThapterImpl object, and sets those comments as attribute in the Variable object.
  • The method sets the modifiers in the Variable object, represented by a collection of strings.
  • For each annotation, invokes the process() method on the Annotation Lyrinx and adds the object returned to the Variable class as attribute.
  • Finally, the artifact of this method (i.e. the instance of the class) is returned to the client (the ClassLyrinx.process() method)

The attributes made available by the Variable component are the following:

  • The annotations, contained in a collection.
  • The Javadocs, represented by an instance of the class.
  • The initial value, represented by an Object type
  • The modifiers, contained in a collection of Strings
  • The unique parent identifier, represented by the hashcode of the Clazz object parent of this instance variable
  • The variable name
  • The variable type, represented by a String which can contain the plain name if the type was in the java.lang package, the fully qualified name otherwise.