Search code examples
xpathpmd

How to access float style in Literal: 0.7f (float style) in PMD via xpath


enter image description here

This is a PMD screen shot for part of my code. I am trying to write a Xpath Query in order to determine the Literal in the above screenshot is float style. Is there any way that I can access that "float style"; Currently, I have something like this //EqualityExpression/PrimaryExpression/PrimanyPrefix/Literal , now, I do not know how to access the float style. Could anyone help me with this? Thank you very much!


Solution

  • The following XPath expression should do the trick:

    //EqualityExpression/PrimaryExpression/PrimaryPrefix/Literal[@FloatLiteral='true']
    

    You can access additional attributes of the Literal. The Designer will show them in the lower left area:

    designer screenshot

    There are other attributes such as "DoubleLiteral", "IntLiteral", "LongLiteral", and so on.