public interface NodeWithTypeArguments<N extends Node>
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.| Modifier and Type | Method and Description |
|---|---|
Optional<NodeList<Type>> |
getTypeArguments() |
default boolean |
isUsingDiamondOperator() |
default N |
removeTypeArguments()
Removes all type arguments, including the surrounding
<>. |
default N |
setDiamondOperator()
Sets the type arguments to
<>. |
N |
setTypeArguments(NodeList<Type> typeArguments)
Allows you to set the generic arguments
|
default N |
setTypeArguments(Type... typeArguments) |
Optional<NodeList<Type>> getTypeArguments()
<String, Integer>.N setTypeArguments(NodeList<Type> typeArguments)
typeArguments - The list of types of the generics, can be nulldefault boolean isUsingDiamondOperator()
<>.default N setDiamondOperator()
<>.default N removeTypeArguments()
<>.Copyright © 2007–2024. All rights reserved.