polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Merlin <paulmer...@apache.org>
Subject Polygene and Kotlin
Date Mon, 24 Apr 2017 06:12:28 GMT
Gang,

I played a little bit with Polygene and Kotlin:

val application = Energy4Java().newApplication(
     ApplicationAssembler { factory ->
         factory.newApplicationAssembly("Application 1") {
             mode = Application.Mode.development
             version = "1"
             setMetaInfo(Object())
             val layer1 = layer("Layer 1") {
                 module("Module 1/A") {
                     values(Some::class) {
                         withTypes(Some::class)
                         forMixin(Some::class).declareDefaults {
                             foo().set("bar")
                         }
                     }
                 }
             }
             val layer2 = layer("Layer 2") {
                 module("Module 2/A") {
                     services(Some::class) {
                         instantiateOnStartup()
                     }
                 }
             }
             layer2.uses(layer1)
         }
     })
application.activate()
application.passivate()

To get to the code above I added a few Kotlin extensions methods to the 
bootstrap api:
https://kotlinlang.org/docs/reference/extensions.html

I'll push some library/lang-kotlin later, but it looks promising 
already.



Mime
View raw message