title: Converting Jython code into a Java Class
body: <p>Goal: allow end users to write jython scripts that will create AI objects [for controlling fleets of spaceships in a game] in Java.</p>
  
  <p>I want the user to be able to write all the logic for the AI in a .py file then convert that code into a java object. I would like to do this without using Java reflection and without running the user's code through an interpreter every time it is needed. The whole point of this is to make the code run as fast as possible, because the AI logic will have to run every game loop.</p>
  
  <p>I've seen Jython's <code>__toJava__</code> method, but I don't really understand how to use it or if it is what I need.</p>
  
  <p>I would greatly appreciate any insight into a good solution to my problem, or knowledge about <code>__toJava__</code>. I am committed to both Java and Jython, so suggesting alternatives is not productive :)</p>