K2V8
K2V8 is a de/serialization library for converting between Kotlin objects and J2V8 V8Objects.
K2V8 uses Kotlin Serialization for the serialization strategy.
Usage
@Serializable
data class ExampleClass (
val value: String
)
val fromObject = ExampleClass("foo")
val v8 = V8.createV8Runtime()
// Initialize K2V8 with an instance of the V8 Runtime
val k2V8 = K2V8(Configuration(v8))
val serializer = ExampleClass.serializer()
// Call toV8 and fromV8 with the serializer to use and the source object
val v8Object = k2V8.toV8(serializer, fromObject)
val kotlinObject = k2V8.fromV8(serializer, v8Object)
Consuming
Add dependency in build.gradle
dependencies {
implementation("com.salesforce.k2v8:k2v8:$k2v8_version")
// optionally J2V8 can be excluded to use specific/newer version
// { exclude group: "com.eclipsesource.j2v8" }
}
Publishing
To publish a new version
- Update the
VERSION
in (gradle.properties](gradle.properties#L15) - Commit changes
./gradlew createTag
(creates a tag locally and pushes to github)./gradlew bintrayUpload
(builds latest and publishes to bintray)