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