public void AddForeignMethod(ForeignMethod fm, ExpandInterceptor expandInterceptor) { var jmtd = new JavaMethod(fm, _helpers, _convert, expandInterceptor, _environment); _methods.Add(jmtd); _blockHost.NativeJavaMethods.Add(jmtd.GenJavaEntrypointMethod(this)); }
public JavaMethod(ForeignMethod fm, ForeignHelpers helpers, Converters.Converter convert, ExpandInterceptor expandInterceptor, IEnvironment env) { _convert = convert; _helpers = helpers; _environment = env; _foreignMethod = fm; _argsWithTypes = JavaMethodArgs(fm.InitialUnoMethod); _argsNoTypes = JavaMethodArgs(fm.InitialUnoMethod, false); Source = GenJavaMethod(fm.InitialUnoMethod, fm.JavaName, expandInterceptor); }
protected override void OnForeignFunction(Function f, List <string> annotations) { // Setup EnsureInitialized(); Helpers.CacheContext(null, f.Source); var fm = new ForeignMethod(f, Essentials, Convert, Helpers, annotations); GenDelegatePlumbing(f); // Generate new java code var jcls = GetJavaClass(f.DeclaringType, Environment); jcls.AddForeignMethod(fm, ExpandInterceptor); // replace the extern body string with the jni calls Helpers.ReplaceBody(f, fm.GetCallFromUno()); // add c++ headers to type Helpers.SourceInclude(fm.CppHeadersForDeclaringType, ((Method)f).DeclaringType); }