| java.lang.Object oscript.data.JavaBridge
JavaBridge | public class JavaBridge (Code) | | Utilities to convert between script and java types.
author: Rob Clark (rob@ti.com) author: version: 1.29 |
Inner Class :abstract public static class FunctionTransformer | |
Inner Class :public interface JavaCallableAccessor | |
Method Summary | |
final public static Object | call(JavaCallableAccessor accessor, int id, Object javaObject, Object[] javaCallables, StackFrame sf, MemberTable args) Since choosing the correct method to call, and correct constructor to
call, uses the same algorithm, instead of duplicating the logic in two
places, it is handled by this method. | public static int | convertArgs(Class[] parameterTypes, Object[] javaArgs, MemberTable args) Utility to convert args to javaArgs of the types specified by
parameterTypes. | public static Object | convertToJavaObject(Value scriptObj, String javaTypeStr) | public static Object | convertToJavaObject(Value scriptObj, Class cls) | final public static Value | convertToScriptObject(Object javaObject) Convert a java object to a script object. | final public static Value | convertToScriptObject(long longVal) | final public static Value | convertToScriptObject(double doubleVal) | final public static Value | convertToScriptObject(boolean javaObject) | final public static Value | convertToScriptObject(String javaObject) | public static void | registerFunctionTransformer(FunctionTransformer ft) |
call | final public static Object call(JavaCallableAccessor accessor, int id, Object javaObject, Object[] javaCallables, StackFrame sf, MemberTable args)(Code) | | Since choosing the correct method to call, and correct constructor to
call, uses the same algorithm, instead of duplicating the logic in two
places, it is handled by this method. Having it in one place also
makes it easier to explore optimizations in the future.
Parameters: accessor - Parameters: id - the symbol (name) of the method/constructor Parameters: javaObject - the java object, to pass to JavaCallableAccessor.call Parameters: javaCallables - the candidate methods/constructors Parameters: sf - the current stack frame Parameters: args - the args the return value of JavaCallableAccessor.call |
convertArgs | public static int convertArgs(Class[] parameterTypes, Object[] javaArgs, MemberTable args)(Code) | | Utility to convert args to javaArgs of the types specified by
parameterTypes. Each array should be of the same length. This
will return a score of the conversion. A score of less than or
equal to zero indicates that the conversion is not possible. A
higher score is better.
|
convertToJavaObject | public static Object convertToJavaObject(Value scriptObj, String javaTypeStr)(Code) | | This is used by java class wrappers to convert the return type back
to a java type:
|
convertToScriptObject | final public static Value convertToScriptObject(Object javaObject)(Code) | | Convert a java object to a script object. Some java types can be
converted back to native script types, rather than need a wrapper,
so this handles that conversion.
Parameters: javaObject - the java object to make a wrapper for |
convertToScriptObject | final public static Value convertToScriptObject(long longVal)(Code) | | |
convertToScriptObject | final public static Value convertToScriptObject(double doubleVal)(Code) | | |
convertToScriptObject | final public static Value convertToScriptObject(boolean javaObject)(Code) | | |
convertToScriptObject | final public static Value convertToScriptObject(String javaObject)(Code) | | |
registerFunctionTransformer | public static void registerFunctionTransformer(FunctionTransformer ft)(Code) | | |
|
|