polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: Polygene and Kotlin
Date Mon, 24 Apr 2017 06:28:17 GMT
Cool. I guess the IDE was guiding a lot to get that right...

On Mon, Apr 24, 2017 at 2:12 PM, Paul Merlin <paulmerlin@apache.org> wrote:

> 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.
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message