Skip to content

vishna/mvel-ktx

Repository files navigation

mvel-ktx

mvel-ktx is a set of Kotlin extensions for MVEL

Getting started

This repository is hosted via jitpack since it's by far the easiest delivery method while also being pretty transparent to the developer.

Make sure you have added jitpack to the list of your repositories:

maven("https://jitpack.io")

Then simply add the mvel-ktx dependency

dependencies {
    compile("com.github.vishna:mvel-ktx:master-SNAPSHOT")
}

Example usage

Interpolation

val interpolatedString  = """@{resultCount} results matching "@{query}"""".interpolate(mapOf(
            "resultCount" to 256,
            "query" to "kotlin"
        ))

print(interpolatedString) // prints "256 results matching "kotlin"

Evaluation

data class Foo(val bar: Int)
val sum : Int = """1 + 2 + bar""".eval(Foo(3))
println(sum) // prints "6"

For more documentation on API see mvel.kt and for more use examples see mvel_tests.kt

About

Kotlin Extensions for MVEL library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages