<commit_before>:toc:
:toclevels: 4

== Rewrite Annotations

toc::[]

The Rewrite annotation support offers an alternative way to configure Rewrite. Compared to configuring
Rewrite using a +ConfigurationProvider+, the annotations allow to place the configuration very close
to the affected code, which some people prefer over a central configuration.

Please note that the Rewrite annotations are not as flexible as a +ConfigurationProvider+.
The main focus of the annotations is to simplify the most common usecases which usually occur
many times in an application. A good example for this are +Join+ rules which are used very often.

NOTE: Of cause you can use a +ConfigurationProvider+ and the annotations side by side. 

=== Configuration

The annotation support of Rewrite is enabled by default. So you usually don't have do add any
additional configuration to use annotations.

If you care about the performance of the annotation scanning process, you can tell Rewrite which
packages to scan for annotations. Restricting the packages may increase performance if you have
a large number of classes in your application.

To tell Rewrite to scan only a specific package including all subpackes, add the following entry
to your +web.xml+:

[source,xml]
.Restrict annotation scanning to a specific package
----
<context-param>
  <param-name>org.ocpsoft.rewrite.annotation.BASE_PACKAGES</param-name>
  <param-value>com.example.myapp</param-value>
</context-param><commit_msg>Typo in index.asciidoc.<commit_after>:toc:
:toclevels: 4

== Rewrite Annotations

toc::[]

The Rewrite annotation support offers an alternative way to configure Rewrite. Compared to configuring
Rewrite using a +ConfigurationProvider+, the annotations allow to place the configuration very close
to the affected code, which some people prefer over a central configuration.

Please note that the Rewrite annotations are not as flexible as a +ConfigurationProvider+.
The main focus of the annotations is to simplify the most common usecases which usually occur
many times in an application. A good example for this are +Join+ rules which are used very often.

NOTE: Of course you can use a +ConfigurationProvider+ and the annotations side by side. 

=== Configuration

The annotation support of Rewrite is enabled by default. So you usually don't have do add any
additional configuration to use annotations.

If you care about the performance of the annotation scanning process, you can tell Rewrite which
packages to scan for annotations. Restricting the packages may increase performance if you have
a large number of classes in your application.

To tell Rewrite to scan only a specific package including all subpackes, add the following entry
to your +web.xml+:

[source,xml]
.Restrict annotation scanning to a specific package
----
<context-param>
  <param-name>org.ocpsoft.rewrite.annotation.BASE_PACKAGES</param-name>
  <param-value>com.example.myapp</param-value>
</context-param>
{'fraction_non_alphanumeric': 0.054072321730314295, 'fraction_numerical': 0.0006759040216289286, 'mean_word_length': 4.955734406438632, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4046328', 'n_tokens_mistral': 775, 'n_tokens_neox': 705, 'n_words': 397}