Package org.jboss.weld.util.bytecode
Class ConstructorUtils
- java.lang.Object
-
- org.jboss.weld.util.bytecode.ConstructorUtils
-
public class ConstructorUtils extends Object
Utility class for working with constructors in the low level javassist API- Author:
- Stuart Douglas
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static void
addDefaultConstructor(org.jboss.classfilewriter.ClassFile file, List<DeferredBytecode> initialValueBytecode, boolean useUnsafeInstantiators)
adds a constructor that calls super()
-
-
-
Method Detail
-
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
-
-