Javaparser: VariableDeclarator

Created on 10 Jan 2019  路  4Comments  路  Source: javaparser/javaparser

Hi

I wonder if it is possible to get the Modifier enum from VariableDeclarator ? I get Modifier enum from class ClassOrInterfaceDeclaration by invoking following command:

   node.getModifiers(); (where node is an instance of ClassOrInterfaceDeclaration  class)

Unfortunately, I did not find the method in VariableDeclarator class. I will appreciate your help.

-- JavaParser version 3.2.3

Best,
Lingbo

Question (JP usage)

All 4 comments

Hi! You're a bit too deep in the AST, the modifiers are on one of the parent nodes. To figure out which one, try this: http://javaparser.org/inspecting-an-ast/

If you need help upgrading to the latest version of JavaParser, just ask.

Thank you matozoid, this is exactly what I want !

Good luck!

Was this page helpful?
0 / 5 - 0 ratings