The steps performed in analyzing a method

The MethodLyrinx.process() method is invoked by the ClassLyrinx.process() method for all methods in a class. The goal of the process() method is to create an instance of the uk.co.jemos.clanker.components.Method class and to add it as child of the uk.co.jemos.clanker.components.Clazz parent class. Here follows the sequence diagram which illustrates the steps performed by the MethodLyrinx.process() method:

These are the steps performed by the MethodLyrinx.process():

  • The method asks the LyrinxManufactory to return an instance of the uk.co.jemos.clanker.lyrinx.ParamLyrinx class, which will be used to delegate the process of method parameters.
  • As it was true with the ClassLyrinx, this method narrows down the com.sun.tools.javac.Tree object to an instance of com.sun.tools.javac.Tree.MethodDef in order to have access to its methods.
  • The method asks the uk.co.jemos.clanker.components.ComponentManufactory to create and return an instance of the main component object of this method: an instance of the uk.co.jemos.clanker.components.Method class.
  • The method retrieves the method's name. If this is the constructor (identified by the name <init>) the entire method processing is skipped (Jemos Clanker is not interested for the moment in constructors' details).
  • The method's name is set as attribute in the Method object.
  • The method then sets the modifiers (such as 'public', 'private', 'final', etc) as attributes in the Method object.
  • The method sets the return type (fully qualified name of the type returned by the method, or void or primitive datatype) as attribute of the Method class.
  • For each parameter, the ParamLyrinx.process() method is invoked. To see what happens there, please see the related documentation.
  • The method then adds each exception in a collection of strings as attribute of the Method object. Each string represents the fully qualified name of the exception class.
  • The method then adds the Method object in the registry maintained in the Amplimet.
  • Similarly with what happened when the class processed the Javadocs, the method retrieves the method's Javadocs from the ThapterImpl class and sets these as attribute in the Method class.
  • The method then loops through each annotation and for each of them invokes the AnnotationLyrinx.process() method which creates and returns an instance of uk.co.jemos.clanker.components.Annotation and each Annotation object is then added in a collection of annotations maintained in the Method class.
  • Finally the Method object is returned to the client (in this case an instance of the uk.co.jemos.clanker.components.Clazz class)

An instance of the uk.co.jemos.clanker.components.Method class offers the following attributes:

  • A collection of uk.co.jemos.clanker.components.Annotation objects
  • The collection of anonymous classes contained within this method
  • The method's Javadoc represented by an instance of the uk.co.jemos.clanker.components.MethodComment class
  • A collection of the exceptions thrown by the method
  • A collection of local variables
  • The list of modifiers, represented by a collection of String objects
  • The method's name
  • The method's parameters, maintained in a collection of uk.co.jemos.clanker.components.Param objects
  • The unique parent identifier, represented by the hashcode of the Clazz object which invoked this processor
  • The return type, identified either by the plain name if the type is contained within the java.lang package, or the fully qualified name if not or the value void if no return type was declared in the method's signature