> For the complete documentation index, see [llms.txt](https://bernardo.gitbook.io/development-docs-java/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bernardo.gitbook.io/development-docs-java/jqassistant/queries/structure.md).

# Structure

## Types extending a base type, along the base type

```
MATCH
   (class),
   (extension:Type)-[:EXTENDS|IMPLEMENTS*0..]->(class)
WHERE
   class.name = 'ClassName'
RETURN
   extension
```

## Methods, including inherited methods, of a class

```
MATCH
   (class),
   (class)-[:EXTENDS|IMPLEMENTS*0..]->()-[:DECLARES]->(inheritedMethod:Method)
WHERE
   class.name = 'ClassName'
RETURN
   class.name AS class,
   inheritedMethod.name AS method
```

## Classes and methods data

```
MATCH
   (class:Type),
   (class)-[:DECLARES]->(method:Method),
   (package:Package)-[:CONTAINS]->(class)
RETURN DISTINCT
   package.fileName AS package,
   class.name AS class,
   class.fileName AS fileName,
   class.fqn AS fullyQualifiedName,
   class.sourceFileName AS sourceFileName,
   class.javaVersion AS javaVersion,
   class.md5 AS md5,
   method.name AS method,
   method.signature AS methodSignature,
   method.firstLineNumber AS firstLine,
   method.lastLineNumber AS lastLine,
   method.effectiveLineCount AS lines,
   method.cyclomaticComplexity AS cyclomaticComplexity,
   class.valid AS validClass,
   class.visibility AS classVisibility,
   method.visibility AS methodVisibility
ORDER BY
   package,
   class,
   method
```

## Methods annotated with PreAuthorize and the permission used

```
MATCH
   (service:Type)-[:DECLARES]->(method:Method),
   (method:Method)-[:ANNOTATED_BY]->(annotation:Annotation)-[:OF_TYPE]->(annotationType:Type),
   (annotation:Annotation)-[:HAS]->(annotationValue:Value{ name:'value' })
WHERE
   annotationType.fqn = 'org.springframework.security.access.prepost.PreAuthorize'
RETURN
   service.name AS service,
   method.name AS method,
   extract(p in apoc.text.regexGroups(annotationValue.value, "\\('([a-zA-Z]*)', '[crud]'\\)") | p[1]) as permission
```

## &#x20;Methods Nobody Calls

```
MATCH
   (class:Type)-[:DECLARES]->(method:Method)
WHERE
   NOT ()-[:INVOKES]->(method)
RETURN
   class,
   method
```

## Non-public methods with annotations

```
MATCH
   (component:Type)-[:DECLARES]->(method:Method),
   (method:Method)-[:ANNOTATED_BY]->(annotation:Annotation)-[:OF_TYPE]->(annotationType:Type)
WHERE
   method.visibility IN ['private', 'protected']
   AND NOT annotationType.fqn = 'java.lang.Deprecated'
RETURN DISTINCT
   component.name AS component,
   method.name AS method,
   annotationType.name AS annotation
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bernardo.gitbook.io/development-docs-java/jqassistant/queries/structure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
