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 = falseOnly ObjectCreationExpr uses the diamond operator. On other nodes it is treated the same as the first case.
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
default N
Removes all type arguments, including the surrounding<>
.default N
Sets the type arguments to<>
.setTypeArguments(NodeList<Type> typeArguments)
Allows you to set the generic argumentsdefault N
setTypeArguments(Type... typeArguments)
-
Method Details
-
getTypeArguments
- Returns:
- the types that can be found in the type arguments:
<String, Integer>
.
-
setTypeArguments
Allows you to set the generic arguments- Parameters:
typeArguments
- The list of types of the generics, can be null
-
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
-