Interface CompositeConfigurationStrategy
A composite configuration strategy allows to specifies the behaviour of a CompositeConfigurationStrategy
.
It basically specifies how the composite source determines whether a result supersedes the result of a previous round (i.e. from a higher priority source), when a result is considered as resolved and what to do in case a source returns an error result.
It also provides a contextual defaulting strategy to use on the underlying sources. The CompositeConfigurationStrategy.CompositeDefaultingStrategy
keeps track of the results of previous rounds in order to optimize the
defaulting queries to execute on the subsequent sources.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A defaulting strategy that can keep track of query results in order to optimize defaulting queries for subsequent rounds. -
Method Summary
Modifier and TypeMethodDescriptionReturns the defaulting strategy that must be applied to sources before executing queries.boolean
Indicates whether or not the specified configuration source error should be ignored when resolving a result.boolean
isResolved
(ConfigurationKey queryKey, ConfigurationKey resultKey) Determines whether the specified result key resolves the specified original query key (ie. there can't be any better result).boolean
isSuperseded
(ConfigurationKey queryKey, ConfigurationKey previousKey, ConfigurationKey resultKey) Determines whether the specified result key supersedes the previous result key retained from previous sources for the specified original query key.lookup()
Returns a lookup composite configuration strategy that ignores failures.lookup
(boolean ignoreFailure) Returns a lookup composite configuration strategy that ignores failures.noOp()
Returns a NoOp composite configuration strategy that ignores failures.noOp
(boolean ignoreFailure) Returns a NoOp composite configuration strategy.
-
Method Details
-
noOp
Returns a NoOp composite configuration strategy that ignores failures.
The NoOp defaulting strategy does not support defaulting.
- Returns:
- a NoOp composite configuration strategy
-
noOp
Returns a NoOp composite configuration strategy.
The NoOp strategy does not support defaulting.
- Parameters:
ignoreFailure
- true to ignore all failure, false otherwise- Returns:
- a NoOp composite configuration strategy
-
lookup
Returns a lookup composite configuration strategy that ignores failures.
The lookup strategy supports defaulting by prioritizing query parameters from left to right (see
DefaultingStrategy.lookup()
.- Returns:
- a lookup composite configuration strategy
-
lookup
Returns a lookup composite configuration strategy that ignores failures.
The lookup strategy supports defaulting by prioritizing query parameters from left to right (see
DefaultingStrategy.lookup()
.- Parameters:
ignoreFailure
- true to ignore all failure, false otherwise- Returns:
- a lookup composite configuration strategy
-
ignoreFailure
Indicates whether or not the specified configuration source error should be ignored when resolving a result.
- Parameters:
error
- a configuration source error- Returns:
- true to ignore the error, false otherwise
-
isSuperseded
boolean isSuperseded(ConfigurationKey queryKey, ConfigurationKey previousKey, ConfigurationKey resultKey) Determines whether the specified result key supersedes the previous result key retained from previous sources for the specified original query key.
- Parameters:
queryKey
- the configuration key representing the original querypreviousKey
- the configuration key of the previous resultresultKey
- the configuration key of the current result- Returns:
- true if the result key superseds the previous result key, false otherwise
-
isResolved
Determines whether the specified result key resolves the specified original query key (ie. there can't be any better result).
- Parameters:
queryKey
- the configuration key representing the original queryresultKey
- the result to test- Returns:
- true if the result resolves the query, false otherwise
-
createDefaultingStrategy
CompositeConfigurationStrategy.CompositeDefaultingStrategy createDefaultingStrategy()Returns the defaulting strategy that must be applied to sources before executing queries.
- Returns:
- a new composite defaulting strategy
-