Top Description Methods
com.github.javaparser.ast.nodeTypes

public Interface NodeWithModifiers<N extends Node>

Known Direct Subinterfaces
com.github.javaparser.ast.nodeTypes.modifiers.NodeWithAbstractModifier, com.github.javaparser.ast.nodeTypes.modifiers.NodeWithFinalModifier, com.github.javaparser.ast.nodeTypes.modifiers.NodeWithPrivateModifier, com.github.javaparser.ast.nodeTypes.modifiers.NodeWithProtectedModifier, com.github.javaparser.ast.nodeTypes.modifiers.NodeWithPublicModifier, com.github.javaparser.ast.nodeTypes.modifiers.NodeWithStaticModifier, com.github.javaparser.ast.nodeTypes.modifiers.NodeWithStrictfpModifier
Imports
com.github.javaparser.ast.AccessSpecifier, .Modifier, .Node, .NodeList, com.github.javaparser.resolution.declarations.HasAccessSpecifier, java.util.Arrays, .List, java.util.function.Supplier, java.util.stream.Collectors

A Node with Modifiers. Note that not all modifiers may be valid for this node.

Method Summary

Modifier and TypeMethod and Description
public default N
addModifier(Modifier.Keyword... newModifiers)

public default AccessSpecifier

Returns:

the access specifier as far as it can be derived from the modifiers. Does not take anything else into account (like "interface methods are implicitly public")
getAccessSpecifier
()

public NodeList<Modifier>

Returns:

modifiers
getModifiers
()

Return the modifiers of this variable declaration.

public default boolean
public default N
removeModifier(Modifier.Keyword... modifiersToRemove)

public default N
setModifier(Modifier.Keyword m, boolean set)

public N
public default N
setModifiers(final Modifier.Keyword... modifiers)

Creates a list of modifier nodes corresponding to the keywords passed, and set it.

Method Detail

addModifierback to summary
public default N addModifier(Modifier.Keyword... newModifiers)
Annotations
@SuppressWarnings:unchecked
getAccessSpecifierback to summary
public default AccessSpecifier getAccessSpecifier()
Returns:AccessSpecifier

the access specifier as far as it can be derived from the modifiers. Does not take anything else into account (like "interface methods are implicitly public")

getModifiersback to summary
public NodeList<Modifier> getModifiers()

Return the modifiers of this variable declaration.

Warning

modifying the returned set will not trigger observers, you have to use setModifiers for that.

Returns:NodeList<Modifier>

modifiers

See Also
Modifier
hasModifierback to summary
public default boolean hasModifier(Modifier.Keyword modifier)
removeModifierback to summary
public default N removeModifier(Modifier.Keyword... modifiersToRemove)
Annotations
@SuppressWarnings:unchecked
setModifierback to summary
public default N setModifier(Modifier.Keyword m, boolean set)
setModifiersback to summary
public N setModifiers(NodeList<Modifier> modifiers)
setModifiersback to summary
public default N setModifiers(final Modifier.Keyword... modifiers)

Creates a list of modifier nodes corresponding to the keywords passed, and set it.