JythonVersionAdapter (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.ext.jython, class: JythonVersionAdapter

Package freemarker.ext.jython

# Class JythonVersionAdapter

java.lang.Object
freemarker.ext.jython.JythonVersionAdapter

public abstract class JythonVersionAdapter extends Object
Functions that has a different implementation depending on the Jython version used. This was introduced to work around class-loading errors because of different classes/methods being present in different Jython versions.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JythonVersionAdapter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract String`
  `getPythonClassName​(org.python.core.PyObject pyObject)`
  Returns `pyObject.__class__.__name__`
  `abstract boolean`
  `isPyInstance​(Object obj)`
  Returns `obj instanceof Py[Java]Instance`.
  `abstract Object`
  `pyInstanceToJava​(Object pyInstance)`
  Returns `((PyInstance) py[Java]Instance).__tojava__(java.lang.Object.class)`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### JythonVersionAdapter

    public JythonVersionAdapter()

- ## Method Details

  - ### isPyInstance

    public abstract boolean isPyInstance​(Object obj)
    Returns `obj instanceof Py[Java]Instance`.

  - ### pyInstanceToJava

    public abstract Object pyInstanceToJava​(Object pyInstance)
    Returns `((PyInstance) py[Java]Instance).__tojava__(java.lang.Object.class)`.

  - ### getPythonClassName

    public abstract String getPythonClassName​(org.python.core.PyObject pyObject)
    Returns `pyObject.__class__.__name__`