uml2re
Class Reflection

java.lang.Object
  |
  +--uml2re.Reflection

public class Reflection
extends java.lang.Object

This class performs the reverse engineering from a set of java class files to a UML2 model. It uses some heuristics to extract meaningful associations between the classes. The XMI conforms to what the Eclipse UML2 tool generates.

Version:
0.1, 04/21/2005
Author:
Marco Torchiano
See Also:
Eclipse UML2 project page

Field Summary
 org.eclipse.uml2.Model mdl
           
 
Constructor Summary
Reflection(java.lang.String modelName, java.lang.String[] classpaths)
          Initialize the model and set the path containing the class files.
 
Method Summary
 void analyzeAll()
          Analyze all classe in the active class path.
 void analyzeClass(java.lang.String className)
          Analyze a single class.
 void save(java.lang.String fileName)
          Save the model as XMI file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mdl

public org.eclipse.uml2.Model mdl
Constructor Detail

Reflection

public Reflection(java.lang.String modelName,
                  java.lang.String[] classpaths)
           throws java.net.MalformedURLException
Initialize the model and set the path containing the class files.

Parameters:
modelName - name of the model created analyzing classes
classpaths - classpath where the classes can be located
Throws:
java.net.MalformedURLException
Method Detail

analyzeClass

public void analyzeClass(java.lang.String className)
                  throws java.lang.Exception
Analyze a single class. The name of the class must be fully qualified (e.g. my.pack.age.Class) The class must be available in the classpath specified in the constructor. This method should not be invoked directly, it works better when all the classes (empty) are already present in the model. It is usually called by the analyzeAll method analyzeAll(). The following heuristics is applied to extract meaningfull associations:

Parameters:
className - the fully qualified name of the class to analyze.
Throws:
java.lang.Exception

analyzeAll

public void analyzeAll()
                throws java.lang.Exception
Analyze all classe in the active class path. The class path is specified as parameter to the constructor.

Throws:
java.lang.Exception

save

public void save(java.lang.String fileName)
          throws java.io.IOException
Save the model as XMI file.

Parameters:
fileName - the filename WITHOUT extension (.uml2 will be added)
Throws:
java.io.IOException