How to reverse a parameterized class realization


Suppose I have a parameterized java class “ClassA” that accepts a generic class type T as a parameter. It also has a method “foo” that returns an object of type T. For example:

public class ClassA {
T foo();

I also have a realization of that parameterized java class that uses “ClassB” in place of T. For example:

private ClassA realizationOfClassA = new ClassA;

This realization is really a 3rd class of its own based on ClassA using the ClassB type.

My question is: How can I get Visual Paradigm to generate the 3rd class into the Class Repository when I reverse engineer this code?



Seems the generic parameter lost in your code. Do you mean your code like this?

public class ClassA<T> {
  T foo();
public class ClassB {
public class ClassC {
  private ClassA<ClassB> test = new ClassA<ClassB>();

You can use Instant Reverse or Reverse Java Code to generate like this:


Thanks for your response. That is not quite what I was expecting. The realization of ClassA is technically a separate class in itself. I would expect to see 4 classes in the diagram above: ClassA, ClassB, ClassC, and a 4th class that is the realization of class A. The way I describe is very useful in a class diagram to visualize all of the classes in the system.


Reversed Class Diagram reflect your source directly. If you change the source to:

public class ClassD extends ClassA<ClassB> {
public class ClassC {
  private ClassD test = new ClassD();

You’ll got this diagram:


That makes sense that it would add ClassD if it is explicitly defined. However there are many cases when template classes are used as-is without extending another class from them (it is not usual to extend an empty class from a realized template). In this case, the UML diagrams (especially sequence diagrams) are missing part of the interaction. I would love to see Visual Paradigm add the ability to reverse engineer realized templates. That would really help. Can you add an enhancement request for this?


If reverse ClassD implicitly, it’ll affect the result of Instant Generator or Round-trip update to code.
Will you consider performing a conversion after Instant Reverse? It can be done by developing a plugin.