public class Jython extends Object implements Serializable, RevisionHandler
| Modifier and Type | Field and Description |
|---|---|
static String |
CLASS_PYTHONINERPRETER
the classname of the Python interpreter
|
static String |
CLASS_PYTHONOBJECTINPUTSTREAM
the classname of the Python ObjectInputStream
|
| Constructor and Description |
|---|
Jython()
default constructor, tries to instantiate a Python Interpreter
|
| Modifier and Type | Method and Description |
|---|---|
static Object |
deserialize(InputStream in)
deserializes the Python Object from the stream
|
Object |
getInterpreter()
returns the currently used Python Interpreter
|
String |
getRevision()
Returns the revision string.
|
static Object |
invoke(Object o,
String methodName,
Class<?>[] paramClasses,
Object[] paramValues)
executes the specified method and returns the result, if any
|
Object |
invoke(String methodName,
Class<?>[] paramClasses,
Object[] paramValues)
executes the specified method on the current interpreter and returns the
result, if any.
|
static boolean |
isPresent()
returns whether the Jython classes are present or not, i.e.
|
static void |
main(String[] args)
If no arguments are given, it just prints the presence of the Jython
classes, otherwise it expects a Jython filename to execute.
|
static Object |
newInstance(File file,
Class<?> template)
loads the module and returns a new instance of it as instance of the
provided Java class template.
|
static Object |
newInstance(File file,
Class<?> template,
File[] paths)
loads the module and returns a new instance of it as instance of the
provided Java class template.
|
static Object |
newInterpreter()
initializes and returns a Python Interpreter
|
public static final String CLASS_PYTHONINERPRETER
public static final String CLASS_PYTHONOBJECTINPUTSTREAM
public Jython()
public Object getInterpreter()
public Object invoke(String methodName, Class<?>[] paramClasses, Object[] paramValues)
methodName - the name of the methodparamClasses - the classes of the parametersparamValues - the values of the parameterspublic static boolean isPresent()
public static Object newInterpreter()
public static Object newInstance(File file, Class<?> template)
file - the Jython module filetemplate - the template for the returned Java objectpublic static Object newInstance(File file, Class<?> template, File[] paths)
file - the Jython module filetemplate - the template for the returned Java objectpaths - additional paths to add to "sys.path"public static Object invoke(Object o, String methodName, Class<?>[] paramClasses, Object[] paramValues)
o - the object the method should be called from, e.g., a Python
InterpretermethodName - the name of the methodparamClasses - the classes of the parametersparamValues - the values of the parameterspublic static Object deserialize(InputStream in)
in - the stream to usepublic String getRevision()
getRevision in interface RevisionHandlerpublic static void main(String[] args)
args - commandline argumentsCopyright © 2016 University of Waikato, Hamilton, NZ. All Rights Reserved.