Class QueryHintOption<HintValue>
java.lang.Object
tools.refinery.interpreter.matchers.backend.QueryHintOption<HintValue>
Each instance of this class corresponds to a given hint option.
It is recommended to expose options to clients (and query backends) as public static fields.
- Since:
- 1.5
-
Constructor Summary
ConstructorsConstructorDescriptionQueryHintOption
(Class<?> optionNamespace, String optionLocalName, T defaultValue) This is the recommended constructor for hint options defined as static fields within an enclosing class.QueryHintOption
(String optionQualifiedName, HintValue defaultValue) Instantiates an option object with the given name and default value. -
Method Summary
Modifier and TypeMethodDescriptionReturns the default value of this hint option, which is to be used by query backends in the case no overriding value is assigned.Returns the qualified name, a unique string identifier of the option.Returns the value of this hint option from the given hint collection, or the default value if not defined.Returns the value of this hint option from the given hint collection, or null if not defined.insertOverridingValue
(Map<QueryHintOption<?>, Object> hints, HintValue overridingValue) Puts a value of this hint option into an option-to-value map.void
insertValueIfNondefault
(Map<QueryHintOption<?>, Object> hints, HintValue overridingValue) Puts a value of this hint option into an option-to-value map, if the given value differs from the default value of the option.boolean
Returns whether this hint option is defined in the given hint collection.toString()
-
Constructor Details
-
QueryHintOption
Instantiates an option object with the given name and default value. -
QueryHintOption
This is the recommended constructor for hint options defined as static fields within an enclosing class. Combines the qualified name of the hint from the (qualified) name of the enclosing class and a local name (unique within that class).
-
-
Method Details
-
getQualifiedName
Returns the qualified name, a unique string identifier of the option. -
getDefaultValue
Returns the default value of this hint option, which is to be used by query backends in the case no overriding value is assigned. -
getValueOrDefault
Returns the value of this hint option from the given hint collection, or the default value if not defined. Intended to be called by backends to find out the definitive value that should be considered. -
getValueOrNull
Returns the value of this hint option from the given hint collection, or null if not defined. -
isOverriddenIn
Returns whether this hint option is defined in the given hint collection. -
insertOverridingValue
public HintValue insertOverridingValue(Map<QueryHintOption<?>, Object> hints, HintValue overridingValue) Puts a value of this hint option into an option-to-value map.This method is offered in lieu of a builder API. Use this method on any number of hint options in order to populate an option-value map. Then instantiate the immutable
QueryEvaluationHint
using the map.- Returns:
- the hint value that was previously present in the map under this hint option, carrying over the semantics of
Map.put(Object, Object)
. - See Also:
-
insertValueIfNondefault
public void insertValueIfNondefault(Map<QueryHintOption<?>, Object> hints, HintValue overridingValue) Puts a value of this hint option into an option-to-value map, if the given value differs from the default value of the option. If the default value is provided instead, then the map is not updated.This method is offered in lieu of a builder API. Use this method on any number of hint options in order to populate an option-value map. Then instantiate the immutable
QueryEvaluationHint
using the map.- Since:
- 2.0
- See Also:
-
toString
-