JBoss Community

Re: Grabbing an existing class's constructors?

created by Robby Cornelissen in Javassist - View the full discussion

I think you're mixing two concepts:

  • Class initializers, AKA static constructor, AKA static initialization block, AKA static { // ... }. This can be obtained by calling getClassInitializer() on a CtClass object, which will return you a corresponding CtConstructor object (if a static initializer was declared in the class).
  • Constructors, which can be obtained by calling getConstructors() on a CtClass object, which will return you an array of CtConstructor objects.

As you are undoubtedly aware, the former is used for class initialization, the latter for object initialization.

Reply to this message by going to Community

Start a new discussion in Javassist at Community