A wrapper around map, allowing to put and get values by keys in a type-safe way. Used in various extension implementations
to manage temporary state. For example:
- When creating ElementPattern, processing context may be used to cache some intermediate data
to be shared between pattern parts.
- Some extensions (e.g, PsiReferenceProvider, CompletionContributors) use per-pattern registration. That allows to use
ElementPattern#save to put matched objects into processing contexts and then retrieve those objects inside extension implementation
after the matching is complete.
Simple processing context can contain a shared processing context inside, which should be used when iterating over several patterns
or extensions, possibly from different plugins. They may still wish to reuse some cached information that a previous extension has already calculated.
In this case, a separate ProcessingContext object is created for each of those extensions, but the same
SharedProcessingContext
is passed to their constructors. To reuse shared context, extensions are required to work with
getSharedContext()
result.
Not thread-safe.