groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aseem Bansal <asmbans...@gmail.com>
Subject Re: Convenient API reference
Date Fri, 29 Jan 2016 15:28:11 GMT
For finding all methods including meta methods use something like

File.metaClass.metaMethods*.name.sort()

On Fri, Jan 29, 2016 at 2:35 PM, Александр Решитько <alexander@reshytko.com>
wrote:

> Thank you for the answer.
>
> Unfortunately <instance>.getClass().methods*.name  doesn't reflect all of
> the instance's methods (as far as i understand it misses those that are
> added by groovy metaprogramming facilities - returning to the File.eachLine
> example - it doesn't contain this method).
>
> 2016-01-29 4:43 GMT+03:00 Edinson E. Padrón Urdaneta <
> edinson.padron.urdaneta@gmail.com>:
>
>> ​> - given an instance of a class in a groovy shell list it's available
>> methods (the only thing I came up with is using a
>> groovy.inspect.swingui.ObjectBrowser)
>>
>> What about <instance>.getClass().methods*.name (e.g.
>> ''.getClass().methods*.name)?
>>
>> > - given a Class name find out it's API and at least short descriptions
>> for its members (for example groovy's File class has a neat method eachLine
>> which I couldn't find neither in Oracle's Java official online API
>> reference nor in Groovy's GDK reference - it might be there but I haven't
>> found it when I needed it). The result is that I use google in such cases
>> which isn't the right way to do it IMHO. groovysh doesn't always give auto
>> complete suggestions for such cases also.
>>
>> Maybe you just missed it?
>> http://docs.groovy-lang.org/latest/html/groovy-jdk/java/io/File.html#eachLine(groovy.lang.Closure)
>>
>> > - given a class method get it's documentation
>>
>> Maybe someone with a greater knowledge than mine can give you a more
>> useful answer about this but, as far as I know, the javadocs aren't part of
>> the bytecode, in other words, the documentation is striped away when the
>> source is compiled into bytecode (Python give you access to the docstrings
>> through the class/method/function's `__doc__` instance variable). So, you
>> can't access the javadocs without the source code.
>>
>
>

Mime
View raw message