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 <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 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 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
-
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.
-