Class JavaPythonTypeConversionImplementor
java.lang.Object
ai.timefold.jpyinterpreter.implementors.JavaPythonTypeConversionImplementor
Implementations of opcodes and operations that require Java to Python or Python to Java conversions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidboxPrimitiveType(Class<?> primitiveType, org.objectweb.asm.MethodVisitor methodVisitor) static voidboxPrimitiveType(org.objectweb.asm.Type primitiveType, org.objectweb.asm.MethodVisitor methodVisitor) static <T> TcoerceToType(PythonLikeObject value, Class<T> type) Coerce a value to a given typestatic <T> TconvertPythonObjectToJavaType(Class<? extends T> type, PythonLikeObject object) Converts aPythonLikeObjectto the giventype.static voidcopyParameter(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper, int parameterIndex) Convert theparameterIndexJava parameter to its Python equivalent and store it into the corresponding Python parameter local variable slot.static PythonLikeTypegetPythonLikeType(Class<?> javaClass) Get thePythonLikeTypeof a javaClass.static voidLoads a String and push it onto the stackstatic voidloadTypeClass(Class<?> type, org.objectweb.asm.MethodVisitor methodVisitor) static voidloadTypeClass(org.objectweb.asm.Type type, org.objectweb.asm.MethodVisitor methodVisitor) static voidreturnValue(org.objectweb.asm.MethodVisitor methodVisitor, MethodDescriptor method, StackMetadata stackMetadata) Ifmethodreturn type is not void, convert TOS into its Java equivalent and return it.static voidunboxBoxedPrimitiveType(Class<?> primitiveType, org.objectweb.asm.MethodVisitor methodVisitor) static voidunboxBoxedPrimitiveType(org.objectweb.asm.Type primitiveType, org.objectweb.asm.MethodVisitor methodVisitor) static PythonLikeObjectwrapJavaObject(Object object) Wrapsobjectto a PythonLikeObject.static PythonLikeObjectwrapJavaObject(Object object, Map<Object, PythonLikeObject> createdObjectMap)
-
Constructor Details
-
JavaPythonTypeConversionImplementor
public JavaPythonTypeConversionImplementor()
-
-
Method Details
-
wrapJavaObject
Wrapsobjectto a PythonLikeObject. -
wrapJavaObject
public static PythonLikeObject wrapJavaObject(Object object, Map<Object, PythonLikeObject> createdObjectMap) -
getPythonLikeType
Get thePythonLikeTypeof a javaClass. -
convertPythonObjectToJavaType
Converts aPythonLikeObjectto the giventype. -
loadName
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
-
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) Ifmethodreturn type is not void, convert TOS into its Java equivalent and return it. Ifmethodreturn type is void, immediately return.- Parameters:
method- The method that is being implemented.
-
coerceToType
Coerce a value to a given type -
copyParameter
public static void copyParameter(org.objectweb.asm.MethodVisitor methodVisitor, LocalVariableHelper localVariableHelper, int parameterIndex) Convert theparameterIndexJava parameter to its Python equivalent and store it into the corresponding Python parameter local variable slot.
-