You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The main consideration for the public API to be exposed for tracking custom events is that the types of attribute values need to be constrained to the following Kotlin types: String, Int, Double, Boolean and Long and the public API should only allow adding these types only.
This can be achieved by leveraging inline value classes in Kotlin which can provide type safety and performance benefits without the overhead of creating separate objects for each attribute value. Inline value classes allow us to wrap primitive types with additional type information at compile time, while still using the underlying primitive type at runtime.
For example, to represent an AttributeValue that can only have a string the following sealed interface can be used with the inline value class:
@Serializable(with =AttributeValueSerializer::class)
sealedinterfaceAttributeValue {
val value:Any
}
@Serializable
@JvmInline
value classStringAttr(overridevalvalue:String) : AttributeValue
The text was updated successfully, but these errors were encountered:
Summary
Feature context: #851
Public API
The main consideration for the public API to be exposed for tracking custom events is that the types of attribute values need to be constrained to the following Kotlin types:
String
,Int
,Double
,Boolean
andLong
and the public API should only allow adding these types only.This can be achieved by leveraging inline value classes in Kotlin which can provide type safety and performance benefits without the overhead of creating separate objects for each attribute value. Inline value classes allow us to wrap primitive types with additional type information at compile time, while still using the underlying primitive type at runtime.
For example, to represent an
AttributeValue
that can only have a string the following sealed interface can be used with the inline value class:The text was updated successfully, but these errors were encountered: