Skip to content

Commit 8de58bc

Browse files
authored
Merge pull request #55 from vsodhi/MTA-3334
MTA-3334 -JAVA annotation
2 parents 2dddc94 + 81a4fd2 commit 8de58bc

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

docs/topics/create-yaml-rule.adoc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The table below lists the available providers and their capabilities. Select a p
2828

2929
.2+.^|`java`
3030
|`referenced`
31-
|Finds references of a pattern with an optional code location for detailed searches
31+
|Finds references of a pattern, including annotations, with an optional code location for detailed searches
3232

3333
|`dependency`
3434
|Checks whether the application has a given dependency
@@ -71,14 +71,17 @@ The table below lists all available providers, their capabilities, and their fie
7171
|===
7272
|Provider |Capability |Field |Required? |Description
7373

74-
.6+.^|`java`
75-
.2+.^|`referenced`
74+
.7+.^|`java`
75+
.3+.^|`referenced`
7676
|`pattern`
7777
|Yes
7878
|RegEx pattern
7979
|`location`
8080
|No
8181
|Source code location; see below for a list of all supported search locations
82+
|`annotated`
83+
|No
84+
|Annotations and their elements (name and value)
8285

8386
.4+.^|`dependency`
8487
|`name`
@@ -203,9 +206,3 @@ when:
203206
location: IMPORT
204207
pattern: junit.junit
205208
----
206-
207-
208-
209-
210-
211-

docs/topics/yaml-rule-structure-syntax.adoc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,17 +361,28 @@ This provider has the following capabilities:
361361

362362
.`referenced`
363363

364-
The `referenced` capability enables the provider to find references in the source code. This capability takes two input parameters, `pattern` and `location`.
364+
The `referenced` capability enables the provider to find references in the source code. This capability takes three input parameters: `pattern`, `location`, and 'annotated'.
365365

366366
[source,terminal]
367367
----
368368
when:
369369
java.referenced:
370370
pattern: "<pattern>" <1>
371371
location: "<location>" <2>
372+
annotated: "<annotated>" <3>
372373
----
373374
<1> A regular expression pattern to match, for example, `org.kubernetes.*`.
374375
<2> Specifies the exact location where the pattern needs to be matched, for example, `IMPORT`.
376+
<3> Checks for specific annotations and their elements, such as name and value in the Java code using a query. For example, the following query matches the Bean(url = “http://www.example.com”) annotation in the method.
377+
+
378+
[source,terminal]
379+
----
380+
annotated:
381+
pattern: org.framework.Bean
382+
elements:
383+
- name: url
384+
value: "http://www.example.com"
385+
----
375386

376387
The supported locations are the following:
377388

@@ -385,6 +396,8 @@ The supported locations are the following:
385396
* `RETURN_TYPE`
386397
* `IMPORT`
387398
* `VARIABLE_DECLARATION`
399+
* `FIELD`
400+
* `METHOD`
388401

389402
.`dependency`
390403

0 commit comments

Comments
 (0)