org.jboss.weld.util.bytecode
Class ConstructorUtils

java.lang.Object
  extended by 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
static void addConstructor(String descriptor, String[] exceptions, javassist.bytecode.ClassFile file, javassist.bytecode.Bytecode initialValueBytecode)
          Adds a constructor that delegates to a super constructor with the same descriptor.
static void addDefaultConstructor(javassist.bytecode.ClassFile file, javassist.bytecode.Bytecode initialValueBytecode)
          adds a constructor that calls super()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addDefaultConstructor

public static void addDefaultConstructor(javassist.bytecode.ClassFile file,
                                         javassist.bytecode.Bytecode initialValueBytecode)
adds a constructor that calls super()


addConstructor

public static void addConstructor(String descriptor,
                                  String[] exceptions,
                                  javassist.bytecode.ClassFile file,
                                  javassist.bytecode.Bytecode initialValueBytecode)
Adds a constructor that delegates to a super constructor with the same descriptor. The bytecode in inialValueBytecode will be executed at the start of the constructor and can be used to inialize 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:
descriptor - the constructor descriptor
exceptions - any exceptions that are thrown
file - the classfile to add the constructor to
initialValueBytecode - bytecode that can be used to set inial values


Copyright © 2013 Seam Framework. All Rights Reserved.