I guess that the reflection API could provide at least the types for methods, 
but from my limited understanding, docstrings are not included in the jar and 
the source is needed. I played around and  for example qdox 
http://qdox.codehaus.org/ seems to be able to extract docstrings. 

python -m jcc.__main__  --package java.io --build --shared --python pyqdox 
--install --exclude com.thoughtworks.qdox.junit.APITestCase --exclude 
com.thoughtworks.qdox.ant.AbstractQdoxTask --reserved VOID --include 
ant-1.5.1.jar --include jmock-1.0.0.jar --include junit-3.8.1.jar --jar 
qdox-2.0-20100906.201255-1.jar 

and 

import pyqdox
pyqdox.initVM()

builder = pyqdox.JavaDocBuilder()

startdir = pyqdox.File('orekit-5.0-src/orekit-5.0/src/main/java/org/orekit/')
print 'dir=',startdir.getCanonicalPath()
print 'exists :',startdir.exists()

builder.addSourceTree(startdir)
src = builder.getSources()

cls = builder.getClassByName('org.orekit.time.AbsoluteDate')
fields = cls.getFields()

m = cls.getMethods()

for mth in m:
    print 'Method: ',mth.getName()
    #print mth.getReturns()
    pars= mth.getParameters()
    if len(pars)==0:
        print 'Parameter: Void'
    else:   
        for par in  pars:
            ptype=par.getType()
            print 'Parameter:',par.getName(), 'Type:',ptype.toString()
       

But looking at the JCC code, I have difficulties understanding where all magic 
is done :)


Regards
/Petrus



On Jun 9, 2011, at 7:13 PM, Andi Vajda wrote:

> 
> Hi Petrus,
> 
> On Thu, 9 Jun 2011, Petrus Hyvönen wrote:
> 
>> Thank you for the support,
>> 
>> Finally I manage to get it working by reserving some words, and minimizing
>> the number of wrapped methods by just including those that I specifically
>> need:
>> 
>> python -m jcc --jar orekit-5.0.jar --include commons-math-2.2.jar --package
>> java.io --package org.apache.commons.math.geometry  --shared  --python
>> orekit --reserved INFINITE --reserved NO_DATA --reserved ERROR --install
>> --build
>> 
>> Is there a way to influence the docstrings generated (__doc__ function?), or
>> is there any way of converting from a javadoc to docstrings of the wrapped
>> library? :)
> 
> If there is a way to get at Java docstrings from the Java reflection API, 
> then that would be a very cool addition to JCC !
> 
> Andi..

_____________________________________________
Petrus Hyvönen, Space Engineer, Uppsala, Sweden
Mobile Phone/SMS:+46 73 803 1900



Reply via email to