Top Description Fields Constructors Methods
com.sun.codemodel

public final Class JInvocation

extends JExpressionImpl
implements JStatement
Class Inheritance
All Implemented Interfaces
com.sun.codemodel.JStatement
Imports
java.util.ArrayList, .List

JMethod invocation

Field Summary

Modifier and TypeField and Description
private List<JExpression>
args

List of argument expressions for this method invocation

private boolean
private JMethod
private String
name

Name of the method to be invoked.

private JGenerable
object

Object expression upon which this method will be invoked, or null if this is a constructor invocation

private JType
type

If isConstructor==true, this field keeps the type to be created.

Constructor Summary

AccessConstructor and Description
pack-priv
JInvocation(JExpression
JExpression for the object upon which the named method will be invoked, or null if none
object
,
String
Name of method to invoke
name
)

Invokes a method on an object.

pack-priv
pack-priv
JInvocation(JClass type, String name)

Invokes a static method on a class.

pack-priv
JInvocation(JClass type, JMethod method)

private
private
JInvocation(JGenerable object, JMethod method)

pack-priv
JInvocation(JType
Type of the object to be created. If this type is an array type, added arguments are treated as array initializer. Thus you can create an expression like new int[]{1,2,3,4,5}.
c
)

Invokes a constructor of an object (i.e., creates a new object.)

Method Summary

Modifier and TypeMethod and Description
public JInvocation
arg(JExpression
Argument to add to argument list
arg
)

Add an expression to this invocation's argument list

public JInvocation
arg(String v)

Adds a literal argument.

public void
public JExpression[]

Returns:

If there's no arguments, an empty array will be returned.
listArgs
()

Returns all arguments of the invocation.

public void
Inherited from com.sun.codemodel.JExpressionImpl:
_instanceofbandborcandcomplementcomponentcordecrdiveqgtgteincrinvokeinvokeltlteminusminusmodmulnenotplusrefrefshlshrshrzxor

Field Detail

argsback to summary
private List<JExpression> args

List of argument expressions for this method invocation

isConstructorback to summary
private boolean isConstructor
methodback to summary
private JMethod method
nameback to summary
private String name

Name of the method to be invoked. Either this field is set, or method, or type (in which case it's a constructor invocation.) This allows the name of the method to be changed later.

objectback to summary
private JGenerable object

Object expression upon which this method will be invoked, or null if this is a constructor invocation

typeback to summary
private JType type

If isConstructor==true, this field keeps the type to be created.

Constructor Detail

JInvocationback to summary
pack-priv JInvocation(JExpression object, String name)

Invokes a method on an object.

Parameters
object:JExpression

JExpression for the object upon which the named method will be invoked, or null if none

name:String

Name of method to invoke

JInvocationback to summary
pack-priv JInvocation(JExpression object, JMethod method)
JInvocationback to summary
pack-priv JInvocation(JClass type, String name)

Invokes a static method on a class.

JInvocationback to summary
pack-priv JInvocation(JClass type, JMethod method)
JInvocationback to summary
private JInvocation(JGenerable object, String name)
JInvocationback to summary
private JInvocation(JGenerable object, JMethod method)
JInvocationback to summary
pack-priv JInvocation(JType c)

Invokes a constructor of an object (i.e., creates a new object.)

Parameters
c:JType

Type of the object to be created. If this type is an array type, added arguments are treated as array initializer. Thus you can create an expression like new int[]{1,2,3,4,5}.

Method Detail

argback to summary
public JInvocation arg(JExpression arg)

Add an expression to this invocation's argument list

Parameters
arg:JExpression

Argument to add to argument list

argback to summary
public JInvocation arg(String v)

Adds a literal argument. Short for arg(JExpr.lit(v))

generateback to summary
public void generate(JFormatter f)

Implements com.sun.codemodel.JGenerable.generate.

Annotations
@Override
listArgsback to summary
public JExpression[] listArgs()

Returns all arguments of the invocation.

Returns:JExpression[]

If there's no arguments, an empty array will be returned.

stateback to summary
public void state(JFormatter f)

Implements com.sun.codemodel.JStatement.state.

Annotations
@Override