public interface TraversalStrategy<S extends TraversalStrategy> extends Serializable, Comparable<Class<? extends TraversalStrategy>>
TraversalStrategy
defines a particular atomic operation for mutating a Traversal
prior to its evaluation.
There are 6 pre-defined "traversal categories": TraversalStrategy.DecorationStrategy
, TraversalStrategy.OptimizationStrategy
, TraversalStrategy.ProviderOptimizationStrategy
, TraversalStrategy.FinalizationStrategy
, and TraversalStrategy.VerificationStrategy
.
Strategies within a category are sorted amongst themselves and then category sorts are applied in the ordered specified previous.
That is, decorations are applied, then optimizations, then provider optimizations, then finalizations, and finally, verifications.
If a strategy does not fit within the specified categories, then it can simply implement TraversalStrategy
and can have priors/posts that span categories.
A traversal strategy should be a final class as various internal operations on a strategy are based on its ability to be assigned to more general classes.
A traversal strategy should typically be stateless with a public static instance()
method.
However, at limit, a traversal strategy can have a state defining constructor (typically via a "builder"), but that state can not mutate once instantiated.Modifier and Type | Interface and Description |
---|---|
static interface |
TraversalStrategy.DecorationStrategy
Implemented by strategies that adds "application logic" to the traversal (e.g.
|
static interface |
TraversalStrategy.FinalizationStrategy
Implemented by strategies that do final behaviors that require a fully compiled traversal to work (e.g.
|
static interface |
TraversalStrategy.OptimizationStrategy
Implemented by strategies that rewrite the traversal to be more efficient, but with the same semantics
(e.g.
|
static interface |
TraversalStrategy.ProviderOptimizationStrategy
Implemented by strategies that rewrite the traversal to be more efficient, but with the same semantics.
|
static interface |
TraversalStrategy.VerificationStrategy
Implemented by strategies where there is no more behavioral tweaking of the traversal required.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(Traversal.Admin<?,?> traversal) |
default Set<Class<? extends S>> |
applyPost()
The set of strategies that must be executed after this strategy is executed.
|
default Set<Class<? extends S>> |
applyPrior()
The set of strategies that must be executed before this strategy is executed.
|
default int |
compareTo(Class<? extends TraversalStrategy> otherTraversalCategory) |
default org.apache.commons.configuration.Configuration |
getConfiguration()
Get the configuration representation of this strategy.
|
default Class<S> |
getTraversalCategory()
The type of traversal strategy -- i.e.
|
static final String STRATEGY
void apply(Traversal.Admin<?,?> traversal)
default Set<Class<? extends S>> applyPrior()
default Set<Class<? extends S>> applyPost()
default Class<S> getTraversalCategory()
TraversalStrategy.DecorationStrategy
, TraversalStrategy.OptimizationStrategy
, TraversalStrategy.FinalizationStrategy
, or TraversalStrategy.VerificationStrategy
.default org.apache.commons.configuration.Configuration getConfiguration()
default int compareTo(Class<? extends TraversalStrategy> otherTraversalCategory)
compareTo
in interface Comparable<Class<? extends TraversalStrategy>>
Copyright © 2013–2018 Apache Software Foundation. All rights reserved.