Class ASTFactory.MethodCallBuilder
- java.lang.Object
-
- com.tonic.analysis.source.editor.util.ASTFactory.MethodCallBuilder
-
- Enclosing class:
- ASTFactory
public static class ASTFactory.MethodCallBuilder extends Object
Builder for method call expressions.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExprStmtasStatement()Builds the call and wraps it as a statement.MethodCallExprbuild()Builds the call, falling back to java/lang/Object when no owner was set.ASTFactory.MethodCallBuilderon(Expression target)Makes the call an instance call on the given receiver, inferring the owner from a field access or defaulting it to java/lang/Object for a variable.ASTFactory.MethodCallBuilderon(String staticOwner)Makes the call a static call on the given class, dropping any receiver.ASTFactory.MethodCallBuilderowner(String ownerClass)Overrides the declaring class without changing the receiver.ASTFactory.MethodCallBuilderreturning(SourceType type)Sets the return type; defaults to void.ASTFactory.MethodCallBuilderwithArgs(Expression... args)Appends arguments to the call.ASTFactory.MethodCallBuilderwithArgs(List<Expression> args)Appends arguments to the call.
-
-
-
Method Detail
-
on
public ASTFactory.MethodCallBuilder on(Expression target)
Makes the call an instance call on the given receiver, inferring the owner from a field access or defaulting it to java/lang/Object for a variable.- Parameters:
target- the receiver expression- Returns:
- this builder
-
on
public ASTFactory.MethodCallBuilder on(String staticOwner)
Makes the call a static call on the given class, dropping any receiver.- Parameters:
staticOwner- the declaring class, in dotted or internal form- Returns:
- this builder
-
owner
public ASTFactory.MethodCallBuilder owner(String ownerClass)
Overrides the declaring class without changing the receiver.- Parameters:
ownerClass- the declaring class, in dotted or internal form- Returns:
- this builder
-
withArgs
public ASTFactory.MethodCallBuilder withArgs(Expression... args)
Appends arguments to the call.- Parameters:
args- the arguments to append, in order- Returns:
- this builder
-
withArgs
public ASTFactory.MethodCallBuilder withArgs(List<Expression> args)
Appends arguments to the call.- Parameters:
args- the arguments to append, in order- Returns:
- this builder
-
returning
public ASTFactory.MethodCallBuilder returning(SourceType type)
Sets the return type; defaults to void.- Parameters:
type- the return type- Returns:
- this builder
-
build
public MethodCallExpr build()
Builds the call, falling back to java/lang/Object when no owner was set.- Returns:
- the call expression
-
asStatement
public ExprStmt asStatement()
Builds the call and wraps it as a statement.- Returns:
- the statement
-
-