Using custom classes in constructor to jython objects

View: New views
2 Messages — Rating Filter:   Alert me  

Using custom classes in constructor to jython objects

by Sam_WIlson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm currently working on a project which requires the integration between java and jython. I am attempting to create a jython object in java, the problem I am having is that I want to pass a java object as a constructor to the jython class but I am unsure how to do this. I have looked at the tutorial but that only uses standard classes as parameters for the constructor.




ThanksĀ 

Sam

------------------------------------------------------------------------------

_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: Using custom classes in constructor to jython objects

by Charlie Groves :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jun 25, 2009 at 12:45 PM, Sam Wilson<samwilson001@...> wrote:
>
> I'm currently working on a project which requires the integration between
> java and jython. I am attempting to create a jython object in java, the
> problem I am having is that I want to pass a java object as a constructor to
> the jython class but I am unsure how to do this. I have looked at the
> tutorial but that only uses standard classes as parameters for the
> constructor.

Do you mean you want to pass a Java object to a Python constructor?
If so, the way to turn a Java object into a PyObject is with
org.python.core.Py.java2py.  It takes any Java object and wraps it in
a PyObject of the appropriate type.  You can then pass that to Python
constructors and methods.

If you really want to pass a Java object as a constructor, I'm not
sure what you mean.

Charlie

------------------------------------------------------------------------------
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users