groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: Strong typing in traits
Date Fri, 17 Jul 2015 17:23:08 GMT
Am 17.07.2015 19:11, schrieb Nikolay Totomanov:
> Hello,
>
> I would like to have strong types in the traits which I use.
> For example in the trait "TraitA" i have a method fillInMap() in which I
> am adding elements to the "map" field
[...]
> traitTraitA {
>
>    deffillInMap(){
>      // here 'map' is with undefined type
>      // is there a way to "suggest" its type
>      map.put('car1','bmw1')
>      map.put('car2','bmw2')
>    }
> }

How about adding a method getMap or the like to the trait?

bye blackdrag

-- 
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/


Mime
View raw message