type ==== .. note:: This target doesn't match any syntactical elements. It is used as an option from another target. In case you want to search for type definitions in code, take a look at :doc:`class`. Sensei allows for both a very simple and very advanced configuration to match types. It is important to note that Sensei will always try to match the :term:`simple name` and :term:`fully qualified name` during the analysis. .. contents:: Shorthands ---------- As stated before, we can use a very simple string-based configuration to match types. We call these configurations *shorthands*. .. code-block:: yaml :emphasize-lines: 3 search: methodcall: type: SomeClass Advanced configuration ---------------------- These shorthand notations are insufficient in certain scenarios. That is why Sensei allows to configure the type-matching in a similar fashion as configuring a target. reference ~~~~~~~~~ This is the actual name of the class that will be used to perform the matching .. code-block:: yaml search: methodcall: type: reference: SomeClass Note that this produces the same result as the following configuration: .. code-block:: yaml search: methodcall: type: SomeClass checkInheritance ~~~~~~~~~~~~~~~~ When ``true``, super classes (and their supers, recursively) of candidate types are also checked. .. code-block:: yaml search: methodcall: returnType: reference: Collection checkInheritance: true The example above will also match on methods with a return type of ``java.util.Stack`` since that type extends ``java.util.Vector``, which implements ``java.util.List``, which extends ``java.util.Collection``. A value of ``false`` has the same effect as not being specified. isPrimitive ~~~~~~~~~~~ If specified, this property checks if the candidate type is one of the primitive types listed below. Matches if either the value is ``true`` and the candidate type is one of the types in the list, or if the value is ``false`` and the type is not any of the types in the list. Primitive types: 1) boolean 2) byte 3) char 4) double 5) float 6) int 7) long 8) short .. include:: /ref/targets/partials/searcher.txt