groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinko Srkoč <dinko.sr...@gmail.com>
Subject Re: respondsTo and constructors
Date Sun, 03 May 2015 14:56:59 GMT
On 1 May 2015 at 16:48, Schalk Cronjé <ysb33r@gmail.com> wrote:
> I cannot figure out how to check for a constructor using respondsTo. If I
> had the following
>
> class ABC {
>   ABC(String s, File f) {}
> }
>
> How can I use respondsTo to see if the constructor exists?

It appears that you cannot. There's a
`MetaClassImpl#retrieveConstructor(Class[])` that may help, or one can
always fallback to Java reflection API.

Cheers,
Dinko

>
> --
> Schalk W. Cronjé
> Twitter / Ello / Toeter : @ysb33r

Mime
View raw message