Package ai.timefold.jpyinterpreter
Class PythonClassTranslator
java.lang.Object
ai.timefold.jpyinterpreter.PythonClassTranslator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordstatic final recordstatic enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateCPythonOperationMethods(org.objectweb.asm.ClassWriter classWriter, String internalClassName, String superClassInternalName, Map<String, PythonLikeType> attributeNameToType) static voidcreateDeleteAttribute(org.objectweb.asm.ClassWriter classWriter, String classInternalName, String superInternalName, Collection<String> instanceAttributes, Map<String, PythonLikeType> fieldToType) static voidcreateGetAttribute(org.objectweb.asm.ClassWriter classWriter, String classInternalName, String superInternalName, Collection<String> instanceAttributes, Map<String, PythonLikeType> fieldToType) createInterfaceForFunctionSignature(PythonClassTranslator.FunctionSignature functionSignature) static voidcreateReadFromCPythonReference(org.objectweb.asm.ClassWriter classWriter, String internalClassName, String superClassInternalName, Map<String, PythonLikeType> attributeNameToType) static voidcreateSetAttribute(org.objectweb.asm.ClassWriter classWriter, String classInternalName, String superInternalName, Collection<String> instanceAttributes, Map<String, PythonLikeType> fieldToType) static voidcreateWriteToCPythonReference(org.objectweb.asm.ClassWriter classWriter, String internalClassName, String superClassInternalName, Map<String, PythonLikeType> attributeNameToType) static StringgetFunctionSignature(PythonCompiledFunction function, String asmMethodDescriptor) static Class<?>getInterfaceClassForDeclaration(PythonClassTranslator.InterfaceDeclaration interfaceDeclaration) getInterfaceForClassPythonFunction(PythonCompiledFunction pythonCompiledFunction) getInterfaceForFunctionSignature(PythonClassTranslator.FunctionSignature functionSignature) getInterfaceForInstancePythonFunction(String instanceInternalClassName, PythonCompiledFunction pythonCompiledFunction) getInterfaceForPythonFunction(PythonCompiledFunction pythonCompiledFunction) getInterfaceForPythonFunctionIgnoringReturn(PythonCompiledFunction pythonCompiledFunction) static StringgetJavaFieldName(String pythonFieldName) static StringgetJavaMethodHolderName(String pythonMethodName) static StringgetJavaMethodName(String pythonMethodName) getPreparedClassInfo(String pythonClassName, String module, String qualifiedName) static StringgetPythonFieldName(String javaFieldName) static StringgetPythonMethodName(String javaMethodName) static PythonLikeTypegetPythonReturnTypeOfFunction(PythonCompiledFunction pythonCompiledFunction, boolean isVirtual) getReferencedSelfAttributes(PythonCompiledFunction pythonCompiledFunction) static org.objectweb.asm.Typestatic voidsetSelfStaticInstances(PythonCompiledClass pythonCompiledClass, Class<?> generatedClass, PythonLikeType pythonLikeType, Map<Number, PythonLikeObject> instanceMap) static PythonLikeTypetranslatePythonClass(PythonCompiledClass pythonCompiledClass) static PythonLikeTypetranslatePythonClass(PythonCompiledClass pythonCompiledClass, PythonClassTranslator.PreparedClassInfo preparedClassInfo)
-
Field Details
-
TYPE_FIELD_NAME
- See Also:
-
CPYTHON_TYPE_FIELD_NAME
- See Also:
-
JAVA_METHOD_PREFIX
- See Also:
-
JAVA_METHOD_HOLDER_PREFIX
- See Also:
-
PYTHON_JAVA_TYPE_MAPPING_PREFIX
- See Also:
-
-
Constructor Details
-
PythonClassTranslator
public PythonClassTranslator()
-
-
Method Details
-
getPreparedClassInfo
public static PythonClassTranslator.PreparedClassInfo getPreparedClassInfo(String pythonClassName, String module, String qualifiedName) -
translatePythonClass
-
translatePythonClass
public static PythonLikeType translatePythonClass(PythonCompiledClass pythonCompiledClass, PythonClassTranslator.PreparedClassInfo preparedClassInfo) -
setSelfStaticInstances
public static void setSelfStaticInstances(PythonCompiledClass pythonCompiledClass, Class<?> generatedClass, PythonLikeType pythonLikeType, Map<Number, PythonLikeObject> instanceMap) -
getJavaFieldName
-
getPythonFieldName
-
getJavaMethodName
-
getJavaMethodHolderName
-
getPythonMethodName
-
getVirtualFunctionReturnType
-
getFunctionSignature
public static String getFunctionSignature(PythonCompiledFunction function, String asmMethodDescriptor) -
createGetAttribute
public static void createGetAttribute(org.objectweb.asm.ClassWriter classWriter, String classInternalName, String superInternalName, Collection<String> instanceAttributes, Map<String, PythonLikeType> fieldToType) -
createSetAttribute
public static void createSetAttribute(org.objectweb.asm.ClassWriter classWriter, String classInternalName, String superInternalName, Collection<String> instanceAttributes, Map<String, PythonLikeType> fieldToType) -
createDeleteAttribute
public static void createDeleteAttribute(org.objectweb.asm.ClassWriter classWriter, String classInternalName, String superInternalName, Collection<String> instanceAttributes, Map<String, PythonLikeType> fieldToType) -
createCPythonOperationMethods
public static void createCPythonOperationMethods(org.objectweb.asm.ClassWriter classWriter, String internalClassName, String superClassInternalName, Map<String, PythonLikeType> attributeNameToType) -
createReadFromCPythonReference
public static void createReadFromCPythonReference(org.objectweb.asm.ClassWriter classWriter, String internalClassName, String superClassInternalName, Map<String, PythonLikeType> attributeNameToType) -
createWriteToCPythonReference
public static void createWriteToCPythonReference(org.objectweb.asm.ClassWriter classWriter, String internalClassName, String superClassInternalName, Map<String, PythonLikeType> attributeNameToType) -
getInterfaceForFunctionSignature
public static PythonClassTranslator.InterfaceDeclaration getInterfaceForFunctionSignature(PythonClassTranslator.FunctionSignature functionSignature) -
getInterfaceForPythonFunction
public static PythonClassTranslator.InterfaceDeclaration getInterfaceForPythonFunction(PythonCompiledFunction pythonCompiledFunction) -
getInterfaceForPythonFunctionIgnoringReturn
public static PythonClassTranslator.InterfaceDeclaration getInterfaceForPythonFunctionIgnoringReturn(PythonCompiledFunction pythonCompiledFunction) -
getInterfaceForInstancePythonFunction
public static PythonClassTranslator.InterfaceDeclaration getInterfaceForInstancePythonFunction(String instanceInternalClassName, PythonCompiledFunction pythonCompiledFunction) -
getInterfaceForClassPythonFunction
public static PythonClassTranslator.InterfaceDeclaration getInterfaceForClassPythonFunction(PythonCompiledFunction pythonCompiledFunction) -
createInterfaceForFunctionSignature
public static PythonClassTranslator.InterfaceDeclaration createInterfaceForFunctionSignature(PythonClassTranslator.FunctionSignature functionSignature) -
getInterfaceClassForDeclaration
public static Class<?> getInterfaceClassForDeclaration(PythonClassTranslator.InterfaceDeclaration interfaceDeclaration) -
getReferencedSelfAttributes
public static Set<String> getReferencedSelfAttributes(PythonCompiledFunction pythonCompiledFunction) -
getPythonReturnTypeOfFunction
public static PythonLikeType getPythonReturnTypeOfFunction(PythonCompiledFunction pythonCompiledFunction, boolean isVirtual)
-