-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathkotlin-bridge.mustache
50 lines (44 loc) · 1.93 KB
/
kotlin-bridge.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright (c) 2021.
* Microsoft Corporation. All rights reserved.
*
*
* This file is automatically generated
* Please DO NOT modify
*/
package com.microsoft.office.outlook.rooster.web.bridge
import com.google.gson.Gson
import com.microsoft.office.outlook.rooster.Callback
import com.microsoft.office.outlook.rooster.web.JsBridge
import com.microsoft.office.outlook.rooster.web.WebEditor
{{#associatedTypes.length}}
import java.lang.reflect.Type
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonPrimitive
import com.google.gson.JsonSerializationContext
import com.google.gson.JsonSerializer
import com.google.gson.annotations.SerializedName
{{/associatedTypes.length}}
interface {{moduleName}}Bridge {
{{#methods}}
fun {{methodName}}({{{parametersDeclaration}}}{{#returnType}}{{#parametersDeclaration.length}}, {{/parametersDeclaration.length}}callback: Callback<{{{returnType}}}>{{/returnType}})
{{/methods}}
}
open class {{moduleName}}Bridge(editor: WebEditor, gson: Gson) : JsBridge(editor, gson, "{{customTags.invokePath}}"), {{moduleName}}Bridge {
{{#methods}}
override fun {{methodName}}({{{parametersDeclaration}}}{{#returnType}}{{#parametersDeclaration.length}}, {{/parametersDeclaration.length}}callback: Callback<{{{returnType}}}>{{/returnType}}) {
{{#returnType}}executeJsForResponse({{{nonOptionalReturnType}}}::class.java, {{/returnType}}{{^returnType}}executeJs({{/returnType}}"{{methodName}}"{{#returnType}}, callback{{/returnType}}{{#parametersDeclaration.length}}, mapOf({{/parametersDeclaration.length}}{{^parameters}}){{/parameters}}
{{#parameters}}
"{{name}}" to {{name}}
{{/parameters}}
{{#parametersDeclaration.length}}
))
{{/parametersDeclaration.length}}
}
{{/methods}}
}
{{#associatedTypes}}
{{> kotlin-named-type}}
{{/associatedTypes}}