Package org.eclipse.ease.lang.python
Class PythonCodeFactory
java.lang.Object
org.eclipse.ease.AbstractCodeFactory
org.eclipse.ease.lang.python.PythonCodeFactory
- All Implemented Interfaces:
ICodeFactory
public class PythonCodeFactory extends AbstractCodeFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.ease.ICodeFactory
ICodeFactory.Parameter
-
Field Summary
Fields inherited from class org.eclipse.ease.AbstractCodeFactory
LINE_DELIMITER
Fields inherited from interface org.eclipse.ease.ICodeFactory
RESULT_NAME, TRACE_MODULE_WRAPPER
-
Constructor Summary
Constructors Constructor Description PythonCodeFactory()
-
Method Summary
Modifier and Type Method Description String
classInstantiation(Class<?> clazz, String[] parameters)
Create code to instantiate a java class.String
createFunctionWrapper(IEnvironment environment, String moduleVariable, Method method)
String
createPep302WrapperCode(EnvironmentModule environment, Object instance, String identifier)
Create wrapper code for Pep302 import statements.String
getSaveVariableName(String variableName)
Converts a given string to a save variable name for the target language.boolean
isValidMethodName(String methodName)
Methods inherited from class org.eclipse.ease.AbstractCodeFactory
createCommentedString, createFunctionCall, createWrapper, getDefaultValue, getMethodAliases, getMethodNames
-
Constructor Details
-
PythonCodeFactory
public PythonCodeFactory()
-
-
Method Details
-
createFunctionWrapper
public String createFunctionWrapper(IEnvironment environment, String moduleVariable, Method method) -
getSaveVariableName
Description copied from interface:ICodeFactory
Converts a given string to a save variable name for the target language. Typically filters invalid characters and verifies that the returned string does not match any reserved keyword. Does not verify if the returned name is already in use.- Parameters:
variableName
- variable name candidate- Returns:
- converted variable name
-
classInstantiation
Description copied from interface:ICodeFactory
Create code to instantiate a java class.- Parameters:
clazz
- class to instantiateparameters
- parameters used for class instantiation- Returns:
- wrapped script code
-
isValidMethodName
-
createPep302WrapperCode
public String createPep302WrapperCode(EnvironmentModule environment, Object instance, String identifier)Create wrapper code for Pep302 import statements.- Parameters:
environment
- script environment instanceinstance
- instance to wrapidentifier
- instance identifier to be used- Returns:
- wrapper code to be loaded by python
-