Class JavaPythonTypeConversionImplementor

java.lang.Object
ai.timefold.jpyinterpreter.implementors.JavaPythonTypeConversionImplementor

public class JavaPythonTypeConversionImplementor extends Object
Implementations of opcodes and operations that require Java to Python or Python to Java conversions.
  • Constructor Details

    • JavaPythonTypeConversionImplementor

      public JavaPythonTypeConversionImplementor()
  • Method Details

    • wrapJavaObject

      public static PythonLikeObject wrapJavaObject(Object object)
      Wraps object to a PythonLikeObject.
    • wrapJavaObject

      public static PythonLikeObject wrapJavaObject(Object object, Map<Object,PythonLikeObject> createdObjectMap)
    • getPythonLikeType

      public static PythonLikeType getPythonLikeType(Class<?> javaClass)
      Get the PythonLikeType of a java Class.
    • convertPythonObjectToJavaType

      public static <T> T convertPythonObjectToJavaType(Class<? extends T> type, PythonLikeObject object)
      Converts a PythonLikeObject to the given type.
    • loadName

      public static void loadName(org.objectweb.asm.MethodVisitor methodVisitor, String name)
      Loads a String and push it onto the stack
      Parameters:
      name - The name to load
    • unboxBoxedPrimitiveType

      public static void unboxBoxedPrimitiveType(Class<?> primitiveType, org.objectweb.asm.MethodVisitor methodVisitor)
    • unboxBoxedPrimitiveType

      public static void unboxBoxedPrimitiveType(org.objectweb.asm.Type primitiveType, org.objectweb.asm.MethodVisitor methodVisitor)
    • boxPrimitiveType

      public static void boxPrimitiveType(Class<?> primitiveType, org.objectweb.asm.MethodVisitor methodVisitor)
    • boxPrimitiveType

      public static void boxPrimitiveType(org.objectweb.asm.Type primitiveType, org.objectweb.asm.MethodVisitor methodVisitor)
    • loadTypeClass

      public static void loadTypeClass(Class<?> type, org.objectweb.asm.MethodVisitor methodVisitor)
    • loadTypeClass

      public static void loadTypeClass(org.objectweb.asm.Type type, org.objectweb.asm.MethodVisitor methodVisitor)
    • returnValue

      public static void returnValue(org.objectweb.asm.MethodVisitor methodVisitor, MethodDescriptor method, StackMetadata stackMetadata)
      If method return type is not void, convert TOS into its Java equivalent and return it. If method return type is void, immediately return.
      Parameters:
      method - The method that is being implemented.
    • coerceToType

      public static <T> T coerceToType(PythonLikeObject value, Class<T> type)
      Coerce a value to a given type
    • copyParameter

      public static void copyParameter(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper, int parameterIndex)
      Convert the parameterIndex Java parameter to its Python equivalent and store it into the corresponding Python parameter local variable slot.