public class CtNewConstructor extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
PASS_ARRAY
Specifies that parameters are converted into an array of
Object and passed to a super-class'
constructor. |
static int |
PASS_NONE
Specifies that no parameters are passed to a super-class'
constructor.
|
static int |
PASS_PARAMS
Specifies that parameters are passed as is
to a super-class' constructor.
|
| Constructor and Description |
|---|
CtNewConstructor() |
| Modifier and Type | Method and Description |
|---|---|
static CtConstructor |
copy(CtConstructor c,
CtClass declaring,
ClassMap map)
Creates a copy of a constructor.
|
static CtConstructor |
defaultConstructor(CtClass declaring)
Creates a default (public) constructor.
|
static CtConstructor |
make(CtClass[] parameters,
CtClass[] exceptions,
String body,
CtClass declaring)
Creates a public constructor.
|
public static final int PASS_NONE
public static final int PASS_ARRAY
Object and passed to a super-class'
constructor.public static final int PASS_PARAMS
public static CtConstructor make(CtClass[] parameters, CtClass[] exceptions, String body, CtClass declaring) throws CannotCompileException
parameters - a list of the parameter types.exceptions - a list of the exception types.body - the source text of the constructor body.
It must be a block surrounded by {}.
If it is null, the substituted
constructor body does nothing except calling
super().declaring - the class to which the created method is added.CannotCompileExceptionpublic static CtConstructor copy(CtConstructor c, CtClass declaring, ClassMap map) throws CannotCompileException
this constructor.
See the description of the constructor for particular behavior of the copying.c - the copied constructor.declaring - the class to which the created method is added.map - the hash table associating original class names
with substituted names.
It can be null.CannotCompileExceptionCtConstructor.CtConstructor(CtConstructor,CtClass,ClassMap)public static CtConstructor defaultConstructor(CtClass declaring) throws CannotCompileException
The created constructor takes no parameter. It calls
super().
CannotCompileExceptionCopyright © December 07, 2012–2015 The Internet Party. All rights reserved.