com.coinbase.cdp.core
- Data-level discrimination: The discriminator (e.g., ‘type’) is inside the JSON data payload. Jackson’s polymorphic deserialization handles this automatically.
- Event-level discrimination: The discriminator (e.g., ‘event’) is at the SSE envelope level. This requires constructing the full SSE envelope for Jackson to process.
Method Details
parseEventLevelUnion
T - The target type
Parameters:
eventType (String) - The SSE event type (from event: field)
data (String) - The SSE data content (from data: field)
id (String) - The SSE event ID (from id: field), may be null
retry (Long) - The SSE retry value (from retry: field), may be null
unionClass (Class<T>) - The target union class
discriminatorProperty (String) - The property name used for discrimination (e.g., “event”)
Returns:
T - The deserialized object
parseDataLevelUnion
T - The target type
Parameters:
data (String) - The SSE data content (from data: field)
valueType (Class<T>) - The target type
Returns:
T - The deserialized object
isEventLevelDiscrimination
discriminatorProperty (String) - The discriminator property name
Returns:
boolean - true if event-level discrimination, false otherwise
findDiscriminatorProperty
unionClass (Class<?>) - The union class to inspect
Returns:
Optional<String> - The discriminator property name, or empty if not found