Interface NodeWithTypeArguments<N extends Node>
- All Known Implementing Classes:
ClassOrInterfaceType, ExplicitConstructorInvocationStmt, FieldAccessExpr, MethodCallExpr, MethodReferenceExpr, ObjectCreationExpr
public interface NodeWithTypeArguments<N extends Node>
A node that can have type arguments.
new X(); --> typeArguments == Optional is empty
new X<>(); --> typeArguments = [], diamondOperator = true
new X<C,D>(); --> typeArguments = [C,D], diamondOperator = false
Only ObjectCreationExpr uses the diamond operator.
On other nodes it is treated the same as the first case.-
Method Summary
Modifier and TypeMethodDescriptiondefault booleandefault NRemoves all type arguments, including the surrounding<>.default NSets the type arguments to<>.setTypeArguments(NodeList<Type> typeArguments) Allows you to set the generic argumentsdefault NsetTypeArguments(Type... typeArguments)
-
Method Details
-
getTypeArguments
-
setTypeArguments
-
isUsingDiamondOperator
default boolean isUsingDiamondOperator()- Returns:
- whether the type arguments look like
<>.
-
setDiamondOperator
Sets the type arguments to<>. -
removeTypeArguments
Removes all type arguments, including the surrounding<>. -
setTypeArguments
-