You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/topics/yaml-rule-structure-syntax.adoc
+90-1Lines changed: 90 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -392,7 +392,7 @@ java.referenced:
392
392
+
393
393
[WARNING]
394
394
====
395
-
When matching against packages, as in the previous example, the asterisk must not be after a dot.
395
+
If you want to match using an asterisk `*` wildcard for a wider range of results, it is recommended to place it directly after the package, not after the dot:
396
396
397
397
For example:
398
398
@@ -431,6 +431,95 @@ java.referenced:
431
431
pattern: java.util.List
432
432
----
433
433
434
+
====== `java` locations
435
+
436
+
The Java provider allows scoping down the search to certain source code locations. You can scope down Java searches from any one of the following search locations:
437
+
438
+
* *IMPORT*: IMPORT allows for searches on class imports. It can either be used with a fully qualified domain name (FQDN) or an asterisk as a wildcard to allow for wider matches:
439
+
+
440
+
For example:
441
+
+
442
+
[source,yaml]
443
+
----
444
+
java.referenced:
445
+
pattern: org.apache.lucene.search*
446
+
location: IMPORT
447
+
----
448
+
449
+
+
450
+
This scope would match on each of these imports:
451
+
+
452
+
[source,java]
453
+
----
454
+
import org.apache.lucene.search.Query;
455
+
import org.apache.lucene.search.Sort;
456
+
import org.apache.lucene.search.SortField;
457
+
----
458
+
+
459
+
If you want to match using an asterisk `*` wildcard for a wider range of results, it is recommended to place it directly after the package, not after the dot:
460
+
461
+
** Use: `org.apache.lucene.search*`
462
+
463
+
** Do not use: `org.apache.lucene.search.*`
464
+
465
+
466
+
* *PACKAGE*: PACKAGE allows for searches on any usage of a package, be it in an import or used as part of a FQDN in the code:
467
+
+
468
+
[source,yaml]
469
+
----
470
+
java.referenced:
471
+
pattern: org.apache.lucene.search*
472
+
location: PACKAGE
473
+
----
474
+
+
475
+
This scope would match on both the import and the fully qualified usage:
476
+
+
477
+
[source,java]
478
+
----
479
+
import org.apache.lucene.search.*;
480
+
----
481
+
+
482
+
[source,java]
483
+
----
484
+
public class Test {
485
+
private org.apache.lucene.search.Query query;
486
+
}
487
+
----
488
+
+
489
+
If you want to match using an asterisk `*` wildcard for a wider range of results, it is recommended to place it directly after the package, not after the dot.
490
+
491
+
492
+
* *CONSTRUCTOR_CALL* and *METHOD_CALL*: for matching constructors and methods, respectively. The pattern possibilities are varied, and it is possible to match against specific return types, arguments, and so on.
493
+
+
494
+
For instance, looking for a method named `method` declared in the `org.konveyor.MyClass` that returns a `List` of a type that extends `java.lang.String` and accepts a single parameter:
More information about the possibilities of these patterns can be found in the link:[Class SearchPattern section] of the Eclipse documentation, which contain all the required information for building these patterns.
504
+
505
+
[WARNING]
506
+
====
507
+
In the current release of {ProductShortName}, fully qualified static method matching does not function as expected.
508
+
====
509
+
510
+
* *TYPE*: matches against types in general, appearing anywhere.
511
+
* *INHERITANCE*: matches against a class inheriting from a given type.
512
+
* *ANNOTATION*: matches against annotations.
513
+
* *IMPLEMENTS_TYPE*: matches against any type implementing the given type.
514
+
* *ENUM_CONSTANT*: matches against enum constants.
515
+
* *RETURN_TYPE*: matches against a type being returned by a method.
516
+
* *VARIABLE_DECLARATION*: matches against a type being declared as a variable.
517
+
* *FIELD* (declaration): matches against a type appearing in a field declaration. It can be coupled with an annotation match, this being an annotation happening on the field.
518
+
* *METHOD*: matches against a given method declaration. It can be coupled with an annotation match.
519
+
* *CLASS* (declaration): matches against a given method declaration. It can be coupled with an annotation match.
0 commit comments