J Fabian Meier
J Fabian Meier

Reputation: 35805

Get annotations from jqassistant after maven repository scan

I scanned my Maven repository with JQassistant. Now I would like to find out which classes are annotated by @Stateful. But even using

MATCH (a:Java:Value:Annotation) RETURN DISTINCT a.name

returns no rows as result. Are annotations not a part of repository scanning? Or do I write a wrong query?

Upvotes: 1

Views: 219

Answers (1)

Dirk Mahler
Dirk Mahler

Reputation: 1266

the following query will return all classes annotated by @Stateful

MATCH
  (t:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(statefulType:Type)
WHERE
  statefulType.fqn = "javax.ejb.Stateful"
RETURN
  t.fqn

If you've scanned a repository it might be useful to also return the artifact that contains these types:

MATCH
  (a:Artifact)-[:CONTAINS]->(t:Type),
  (t)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(statefulType:Type)
WHERE
  statefulType.fqn = "javax.ejb.Stateful"
RETURN
  a.fqn, collect(t.fqn)

Upvotes: 2

Related Questions