Implementation:Apache Shardingsphere PreciseHintShadowValue DTO
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Shadow_Testing, SPI |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Immutable value object carrying hint shadow context for hint-based shadow algorithm evaluation.
Description
PreciseHintShadowValue<T> is a generic final class that bundles the context needed by HintShadowAlgorithm implementations: the logical table name, the shadow operation type, and the hint value extracted from SQL annotations. Uses Lombok @RequiredArgsConstructor and @Getter.
Usage
This DTO is constructed by the shadow routing engine and passed to HintShadowAlgorithm.isShadow() during hint-based shadow routing evaluation.
Code Reference
Source Location
- Repository: Apache_Shardingsphere
- File: features/shadow/api/src/main/java/org/apache/shardingsphere/shadow/spi/hint/PreciseHintShadowValue.java
- Lines: 1-39
Signature
@RequiredArgsConstructor
@Getter
public final class PreciseHintShadowValue<T> implements ShadowValue {
private final String tableName;
private final ShadowOperationType shadowOperationType;
private final T value;
}
Import
import org.apache.shardingsphere.shadow.spi.hint.PreciseHintShadowValue;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| tableName | String | Yes | Logical table name |
| shadowOperationType | ShadowOperationType | Yes | SQL operation type |
| value | T | Yes | Hint value from SQL annotation |
Outputs
| Name | Type | Description |
|---|---|---|
| getTableName() | String | Logical table name |
| getShadowOperationType() | ShadowOperationType | SQL operation type |
| getValue() | T | Hint value |
Usage Examples
import org.apache.shardingsphere.shadow.spi.hint.PreciseHintShadowValue;
import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
// Construct a hint shadow value
PreciseHintShadowValue<String> hintValue = new PreciseHintShadowValue<>(
"t_order", ShadowOperationType.HINT_MATCH, "true");
// Access fields
String table = hintValue.getTableName(); // "t_order"
ShadowOperationType opType = hintValue.getShadowOperationType(); // HINT_MATCH
String hint = hintValue.getValue(); // "true"
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment