Package org.jboss.weld.util.bytecode
Class ConstructorUtils
java.lang.Object
org.jboss.weld.util.bytecode.ConstructorUtils
Utility class for working with constructors in the low level javassist API
- Author:
- Stuart Douglas
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddConstructor(String returnType, String[] params, String[] exceptions, org.jboss.classfilewriter.ClassFile file, List<DeferredBytecode> initialValueBytecode, boolean useUnsafeInstantiators) Adds a constructor that delegates to a super constructor with the same descriptor.static voidaddDefaultConstructor(org.jboss.classfilewriter.ClassFile file, List<DeferredBytecode> initialValueBytecode, boolean useUnsafeInstantiators) adds a constructor that calls super()
-
Method Details
-
addDefaultConstructor
public static void addDefaultConstructor(org.jboss.classfilewriter.ClassFile file, List<DeferredBytecode> initialValueBytecode, boolean useUnsafeInstantiators) adds a constructor that calls super() -
addConstructor
public static void addConstructor(String returnType, String[] params, String[] exceptions, org.jboss.classfilewriter.ClassFile file, List<DeferredBytecode> initialValueBytecode, boolean useUnsafeInstantiators) Adds a constructor that delegates to a super constructor with the same descriptor. The bytecode in initialValueBytecode will be executed at the start of the constructor and can be used to initialize fields to a default value. As the object is not properly constructed at this point this bytecode may not reference this (i.e. the variable at location 0)- Parameters:
returnType- the constructor descriptorexceptions- any exceptions that are thrownfile- the classfile to add the constructor toinitialValueBytecode- bytecode that can be used to set initial values
-