Interface NodeWithModifiers<N extends Node>

All Known Subinterfaces:
NodeWithAbstractModifier<N>, NodeWithAccessModifiers<N>, NodeWithFinalModifier<N>, NodeWithPrivateModifier<N>, NodeWithProtectedModifier<N>, NodeWithPublicModifier<N>, NodeWithStaticModifier<N>, NodeWithStrictfpModifier<N>
All Known Implementing Classes:
AnnotationDeclaration, AnnotationMemberDeclaration, CallableDeclaration, ClassOrInterfaceDeclaration, CompactConstructorDeclaration, ConstructorDeclaration, EnumDeclaration, FieldDeclaration, MethodDeclaration, ModuleRequiresDirective, Parameter, RecordDeclaration, TypeDeclaration, VariableDeclarationExpr

public interface NodeWithModifiers<N extends Node>
A Node with Modifiers. Note that not all modifiers may be valid for this node.
  • Method Details

    • getModifiers

      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:
      modifiers
      See Also:
      Modifier
    • setModifiers

      N setModifiers(NodeList<Modifier> modifiers)
    • addModifier

      default N addModifier(Modifier.Keyword... newModifiers)
    • removeModifier

      default N removeModifier(Modifier.Keyword... modifiersToRemove)
    • setModifier

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

      default boolean hasModifier(Modifier.Keyword modifier)
      Parameters:
      modifier - the modifer being searched for
      Returns:
      true if the modifier has been explicitly added to this node, else false
    • setModifiers

      default N setModifiers(Modifier.Keyword... modifiers)
      Creates a list of modifier nodes corresponding to the keywords passed, and set it.
    • getAccessSpecifier

      default AccessSpecifier getAccessSpecifier()
      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")