public final class AutoRefine extends Object implements DependentPlugin
Refinable
types.
This plugin should be added to the parse operation as the easiest to way ensure refinement of certain or all Refinable
types is performed. It should be added last so that other custom refiners will not be preempted.
Refinement ensures that subscription methods to leaf syntax units (such as UrlFunctionValue
or ClassSelector
)
are delivered. Such units will not be delivered if the parent selector or declaration was not refined. For more information on
refinement see the main readme file.
Example:
Omakase.use(AutoRefine.everything()).use(...).process();
Omakase.use(AutoRefine.only(Match.FUNCTIONS).use(...).process();
If including this plugin as a dependency then it's preferred to refine everything, otherwise consider requiring a more
specific refiner plugin such as DeclarationPlugin
instead.Modifier and Type | Class and Description |
---|---|
static class |
AutoRefine.Match
Types of
Refinable s to auto-refine. |
Constructor and Description |
---|
AutoRefine()
Creates a new
AutoRefine matching all Refinable s. |
AutoRefine(EnumSet<AutoRefine.Match> matches)
Creates a new
AutoRefine matching the specified types. |
Modifier and Type | Method and Description |
---|---|
void |
dependencies(PluginRegistry registry)
Registers plugin dependencies.
|
static AutoRefine |
everything()
Creates an
AutoRefine that matches everything. |
static AutoRefine |
only(AutoRefine.Match match,
AutoRefine.Match... matches)
Creates an
AutoRefine that matches the specified types. |
public AutoRefine()
AutoRefine
matching all Refinable
s.public AutoRefine(EnumSet<AutoRefine.Match> matches)
AutoRefine
matching the specified types.matches
- Types of Refinable
s to auto-refine.public void dependencies(PluginRegistry registry)
DependentPlugin
Any plugins you add to the registry in this method will be ordered before this plugin itself.
Keep in mind that only one instance of a plugin can be added in a single parsing operation. You can use PluginRegistry.require(Class)
, PluginRegistry.require(Class, Supplier)
and PluginRegistry.retrieve(Class)
to assist in scenarios where a plugin instance may have already been added.
Dependencies to include can range from refinement dependencies such as SelectorPlugin
and MediaPlugin
to
other custom plugins.
dependencies
in interface DependentPlugin
registry
- The PluginRegistry
instance.PluginRegistry.require(Class)
,
PluginRegistry.require(Class, Supplier)
,
PluginRegistry.retrieve(Class)
public static AutoRefine everything()
AutoRefine
that matches everything.AutoRefine
instance.public static AutoRefine only(AutoRefine.Match match, AutoRefine.Match... matches)
AutoRefine
that matches the specified types.match
- The first match.matches
- Optional additional matches.AutoRefine
instance.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.