Re: Java object conversion using ConfigSlurper

2018-05-16 Thread mg
Datum: 16.05.18 16:00 (GMT+01:00) An: d...@groovy.incubator.apache.org Betreff: Re: Java object conversion using ConfigSlurper Yes Jesper, It works. But, If that `MyConfig` class has fields of `List` or `Map` types, then it does not work. I am looking this feature as a way of converting `Config

Re: Java object conversion using ConfigSlurper

2018-05-16 Thread mg
Datum: 16.05.18 16:00 (GMT+01:00) An: d...@groovy.incubator.apache.org Betreff: Re: Java object conversion using ConfigSlurper Yes Jesper, It works. But, If that `MyConfig` class has fields of `List` or `Map` types, then it does not work. I am looking this feature as a way of converting `Config

Re: Java object conversion using ConfigSlurper

2018-05-16 Thread mg
ff: Re: Java object conversion using ConfigSlurper Hi Mario Garcia, Groovy already has Map coercion feature with which the methods of any class can be delegated to the closures in Map. This uses `as` keyword. If we implement `asType(Class)` in `ConfigObject` (ConfigObject already implements Map)

Re: Java object conversion using ConfigSlurper

2018-05-16 Thread mg
ff: Re: Java object conversion using ConfigSlurper Hi Mario Garcia, Groovy already has Map coercion feature with which the methods of any class can be delegated to the closures in Map. This uses `as` keyword. If we implement `asType(Class)` in `ConfigObject` (ConfigObject already implements Map)

Re: Java object conversion using ConfigSlurper

2018-05-16 Thread Jesper Steen Møller
Hi Adithyank > On 16 May 2018, at 12.52, adithyank wrote: > > Hi Mario Garcia, > > Groovy already has Map coercion feature with which the methods of any class > can be delegated to the closures in Map. This uses `as` keyword. > > If we implement `asType(Class)` in

Re: Java object conversion using ConfigSlurper

2018-05-16 Thread adithyank
Hi Mario Garcia, Groovy already has Map coercion feature with which the methods of any class can be delegated to the closures in Map. This uses `as` keyword. If we implement `asType(Class)` in `ConfigObject` (ConfigObject already implements Map), some of the functionalities of existing coercion

Re: Java object conversion using ConfigSlurper

2018-05-16 Thread Mario Garcia
Hi, good work :) It seems a nice feature, but I'm wondering why having two different methods doing the same ? asType and getAs. - I think is always better to avoid having two methods doing the same, specially when asType can be called both directly or via sugar syntax. - I also think

Re: Java object conversion using ConfigSlurper

2018-05-15 Thread Daniel.Sun
I think it is nice for me :-) Cheers, Daniel.Sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Re: Java object conversion using ConfigSlurper

2018-05-15 Thread adithyank
Ok. Thanks Daniel. I will proceed in the below way. Pls advice 1. I will write new class `ConfigCustomObjectBuilder` in `ConfigSlurper.groovy` to convert given ConfigObject to custom class instance 2. I will add below new method in ConfigObject T getAs(Class dataStructure) {

Re: Java object conversion using ConfigSlurper

2018-05-12 Thread Daniel.Sun
I think it is useful especially for Java developers. PR is welcome. P.S. it would be better if the Java class is a Java bean(with getters and setters) Cheers, Daniel.Sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Java object conversion using ConfigSlurper

2018-05-10 Thread K Adithyan (tech)
Team, ConfigSlurper can be used to parse groovy-styled configurations and get them as *ConfigObject. *As an additional feature, either ConfigSlurper can be enhanced or a new class can be written to return java object itself from the configuration. Example below *config.groovy* myownconfig {