Skip to content

[Apex] Is InterfaceNames available to be used in a custom XPath rule? #4950

Answered by jsotuyod
thvd asked this question in Q&A
Discussion options

You must be logged in to vote

For completeness, I've just submitted a PR for PMD 7.1.0 that would expose collection attributes such as getInterfaceNames() as an XPath attribute through a sequence. #4969

With that you should be able to write

//UserClass[
  not(empty(index-of(@InterfaceNames, 'Queueable'))). (: implements Queueable :)
  and empty(index-of(@InterfaceNames, 'Finalizer')) (: but doesn't implement Finalizer :)
]

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@oowekyala
Comment options

Comment options

You must be logged in to vote
1 reply
@oowekyala
Comment options

Answer selected by thvd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants