@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Rework
Syntax
objects when the method is expected to change or modify the object/source
code.
Examples of rework include adding cache-busters to urls, changing class names, flipping directions for RTL support, etc... It basically represents changing the content.
The one and only parameter for methods with this annotation should be one of the Syntax
types. It is generally better
to subscribe the the most specific unit as possible (e.g., UrlFunctionValue
instead of Declaration
), however
note that lower-level syntax types will not be delivered if the parent type is not refined. See the main readme file for more
information about refinement. Generally, if you are parsing with AutoRefine
or StandardValidation
then all
syntax types will be delivered.
If the method does not intend to change the content or object, use Observe
instead.
All Rework
subscriptions will be delivered after Refine
methods have finished executing.
Inside of a rework method, you can remove a unit from the syntax tree by calling Groupable#destroy()
. Once a unit is
destroyed it is no longer broadcasted to any subsequent plugins, including validation. Destroyed units cannot be added to the
tree again, however they can still be copied. If you are storing the units in a cache then you will probably want to check
Groupable#isDestroyed()
upon later access as the unit may have been destroyed by another plugin.
See SimpleReworkTest.java for same rework method implementations.
Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.