├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── user
│ │ └── myapplication
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ ├── com
│ │ │ ├── example
│ │ │ │ └── user
│ │ │ │ │ └── myapplication
│ │ │ │ │ ├── MainActivity.kt
│ │ │ │ │ └── SwiftApp.kt
│ │ │ └── johnholdsworth
│ │ │ │ └── swiftbindings
│ │ │ │ ├── SwiftHelloBinding.java
│ │ │ │ ├── SwiftHelloTest.java
│ │ │ │ └── SwiftHelloTypes.java
│ │ └── org
│ │ │ └── swiftjava
│ │ │ ├── com_johnholdsworth
│ │ │ ├── SwiftHelloBinding_ListenerProxy.java
│ │ │ ├── SwiftHelloTest_TestListenerProxy.java
│ │ │ ├── SwiftHelloTest_TestResponderAdapterProxy.java
│ │ │ └── SwiftHelloTypes_TextListenerProxy.java
│ │ │ └── java_swift
│ │ │ └── RunnableProxy.java
│ ├── res
│ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ └── content_main.xml
│ │ ├── menu
│ │ │ └── menu_main.xml
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── raw
│ │ │ └── cacert.pem
│ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ └── swift
│ │ ├── Package.swift
│ │ └── Sources
│ │ ├── Statics.swift
│ │ ├── SwiftHelloBinding.swift
│ │ ├── SwiftHelloBinding_Listener.swift
│ │ ├── SwiftHelloBinding_Responder.swift
│ │ ├── SwiftHelloTest.swift
│ │ ├── SwiftHelloTestImpl.swift
│ │ ├── SwiftHelloTest_SwiftTestListener.swift
│ │ ├── SwiftHelloTest_TestListener.swift
│ │ ├── SwiftHelloTest_TestResponderAdapter.swift
│ │ ├── SwiftHelloTypes.swift
│ │ ├── SwiftHelloTypes_ListenerMap.swift
│ │ ├── SwiftHelloTypes_ListenerMapList.swift
│ │ ├── SwiftHelloTypes_Planet.swift
│ │ ├── SwiftHelloTypes_StringMap.swift
│ │ ├── SwiftHelloTypes_StringMapList.swift
│ │ ├── SwiftHelloTypes_TextListener.swift
│ │ └── swifthello.swift
│ └── test
│ └── java
│ └── com
│ └── example
│ └── user
│ └── myapplication
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── hybrid.t2d
├── settings.gradle
└── swift-android-kotlin.iml
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | jniLibs
9 | /captures
10 | .externalNativeBuild
11 | *.pins
12 | *.resolved
13 | .build
14 | build
15 | jniLibs
16 | Packages
17 | *.class
18 | *.so
19 | *.apk
20 | vcs.xml
21 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
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 | 1.8
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin example for the Android Swift toolchain.
2 |
3 | 
4 |
5 | An example application for mixing Swift and Kotlin in an Android application. This allows you to reuse model layer code from your iOS application when porting to Android. The "binding" between the Kotlin or Java code and Swift is completely type safe with all JNI code automatically generated using a script. Building the Swift code is performed using the Swift Package manager and a small gradle plugin.
6 |
7 | Requires a build of the latest Android toolchain downloadable [here](http://johnholdsworth.com/android_toolchain.tgz). Once you've extracted the toolchain, run `swift-install/setup.sh` to get started and install the gradle plugin. You then run `./gradlew installDebug` or build the project in Android Studio. Make sure the that the `ANDROID_HOME` environment variable is set to the path to an [Android SDK](https://developer.android.com/studio/index.html). The phone must be api 21 aka Android v5+ aka Lollipop or better (I used an LG K4.)
8 |
9 | To create a new application, decide on a pair of interfaces to connect to and from your Swift
10 | code and place them in a [Java Source](https://github.com/SwiftJava/swift-android-kotlin/blob/master/app/src/main/java/com/johnholdsworth/swiftbindings/SwiftHelloBinding.java). Use the command `./genswift.sh` in the [SwiftJava Project](https://github.com/SwiftJava/SwiftJava) to generate Swift (& Java) sources to include in your application or adapt the [genhello.sh](https://github.com/SwiftJava/SwiftJava/blob/master/genhello.sh) script. Your app's only
11 | [Package.swift](https://github.com/SwiftJava/swift-android-kotlin/blob/master/app/src/main/swift/Package.swift)
12 | dependency should be the core JNI interfacing code [java_swift](https://github.com/SwiftJava/java_swift).
13 |
14 | This example is coded to work with version 7 of the toolchain which has some additional requirements
15 | to work around requirements of the Swift port of Foundation. The cache directory used by web operations
16 | needs to be setup in the environment variable "TMPDIR". This would usually be the value of
17 | Context.getCacheDir().getPath() from the java side. In addition, to be able to use SSL you
18 | need to add a [CARoot info file](http://curl.haxx.se/docs/caextract.html) to the application's
19 | raw resources and copy it to this cache directory to be picked up by Foundation as follows:
20 |
21 | setenv("URLSessionCertificateAuthorityInfoFile", cacheDir! + "/cacert.pem", 1)
22 | setenv("TMPDIR", cacheDir!, 1)
23 |
24 | If you don't want peer validation you have the following option (not recommended at all)
25 |
26 | setenv("URLSessionCertificateAuthorityInfoFile", “INSECURE_SSL_NO_VERIFY”, 1)
27 |
28 | ## Simple demo of Swift code accessed over JNI.
29 |
30 | To build, setup the Gradle plugin, then run `./gradlew installDebug`
31 |
32 | This demo is licensed under the Creative Commons CC0 license:
33 | do whatever you want.
34 |
35 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | generateDebugSources
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 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'net.zhuoweizhang.swiftandroid'
4 |
5 | android {
6 | compileSdkVersion 25
7 | buildToolsVersion "26.0.1"
8 | defaultConfig {
9 | applicationId "com.example.user.myapplication"
10 | minSdkVersion 21
11 | targetSdkVersion 25
12 | versionCode 1
13 | versionName "1.0"
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar', '**/*.so'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | compile 'com.android.support:appcompat-v7:25.3.1'
30 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
31 | compile 'com.android.support:design:25.3.1'
32 | testCompile 'junit:junit:4.12'
33 | compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
34 | }
35 | repositories {
36 | mavenCentral()
37 | }
38 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/user/Android/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/user/myapplication/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.user.myapplication;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.user.myapplication", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
14 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/user/myapplication/MainActivity.kt:
--------------------------------------------------------------------------------
1 |
2 | package com.example.user.myapplication
3 |
4 | import android.os.Bundle
5 | import android.support.design.widget.FloatingActionButton
6 | import android.support.design.widget.Snackbar
7 | import android.support.v7.app.AppCompatActivity
8 | import android.support.v7.widget.Toolbar
9 | import android.view.Menu
10 | import android.view.MenuItem
11 | import android.widget.TextView
12 |
13 | import com.johnholdsworth.swiftbindings.SwiftHelloBinding.Listener
14 | import com.johnholdsworth.swiftbindings.SwiftHelloBinding.Responder
15 |
16 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.TextListener
17 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap
18 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList
19 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMap
20 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMapList
21 |
22 | import com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener
23 | import com.johnholdsworth.swiftbindings.SwiftHelloTest.SwiftTestListener
24 |
25 | import java.io.*
26 |
27 | class MainActivity : AppCompatActivity(), Responder {
28 |
29 | /** Implemented in src/main/swift/Sources/main.swift **/
30 | internal external fun bind(self: Responder): Listener
31 |
32 | override fun onCreate(savedInstanceState: Bundle?) {
33 | super.onCreate(savedInstanceState)
34 | setContentView(R.layout.activity_main)
35 | val toolbar = findViewById(R.id.toolbar) as Toolbar
36 | setSupportActionBar(toolbar)
37 |
38 | val fab = findViewById(R.id.fab) as FloatingActionButton
39 | fab.setOnClickListener { view ->
40 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
41 | .setAction("Action", null).show()
42 | }
43 |
44 | Thread() {
45 | loadNativeDependencies()
46 |
47 | listener = bind(this)
48 | val context = SwiftApp.sharedApplication.getApplicationContext()
49 | val cacheDir = context?.getCacheDir()?.getPath()
50 | val pemfile = cacheDir + "/cacert.pem"
51 | val pemStream = SwiftApp.sharedApplication.getResources()?.openRawResource(R.raw.cacert)
52 | copyResource(pemStream, pemfile)
53 | listener.setCacheDir(cacheDir)
54 |
55 | basicTests(10)
56 |
57 | listener.processText("World")
58 | }.start()
59 | }
60 |
61 | private fun basicTests(reps: Int) {
62 | for (i in 1..reps) {
63 | try {
64 | listener.throwException()
65 | } catch (e: Exception) {
66 | System.out.println("**** Got Swift Exception ****")
67 | e.printStackTrace()
68 | }
69 | }
70 |
71 | for (i in 1..reps) {
72 | listener.processStringMap(StringMap(hashMapOf("hello" to "world")))
73 | listener.processStringMapList(StringMapList(hashMapOf(("hello" to Array(1, { "world" })))))
74 | }
75 |
76 | val tester = listener.testResponder(2)
77 | for (i in 1..reps) {
78 | SwiftTestListener().respond(tester)
79 | }
80 | }
81 |
82 | private fun copyResource(`in`: InputStream?, to: String) {
83 | try {
84 | val out = FileOutputStream(to)
85 | `in`?.copyTo(out)
86 | `in`?.close()
87 | out.close()
88 | } catch (e: IOException) {
89 | e.printStackTrace()
90 | System.out.println("" + e)
91 | }
92 |
93 | }
94 |
95 | override fun onCreateOptionsMenu(menu: Menu): Boolean {
96 | // Inflate the menu; this adds items to the action bar if it is present.
97 | menuInflater.inflate(R.menu.menu_main, menu)
98 | return true
99 | }
100 |
101 | override fun onOptionsItemSelected(item: MenuItem): Boolean {
102 | // Handle action bar item clicks here. The action bar will
103 | // automatically handle clicks on the Home/Up button, so long
104 | // as you specify a parent activity in AndroidManifest.xml.
105 | val id = item.itemId
106 |
107 |
108 | if (id == R.id.action_settings) {
109 | return true
110 | }
111 |
112 | return super.onOptionsItemSelected(item)
113 | }
114 |
115 | override fun processedNumber(number: Double) {
116 | val myText = findViewById(R.id.mytext) as TextView
117 | myText.text = "Result of swift return42() function is " + number
118 | }
119 |
120 | override fun processedText(text: String) {
121 | runOnUiThread {
122 | val myText = findViewById(R.id.mytext) as TextView
123 | myText.text = "Processed text: " + text
124 | }
125 | }
126 |
127 | override fun processedTextListener(text: TextListener) {
128 | processedText( text.getText() );
129 | }
130 |
131 | override fun processedTextListenerArray(text: Array?) {
132 | processedText( text!![0].getText() );
133 | }
134 |
135 | override fun processedTextListener2dArray(text: Array>?) {
136 | processedText( text!![0][0].getText() );
137 | }
138 |
139 | override fun processMap(map: ListenerMap?) {
140 | listener.processedMap( map )
141 | }
142 |
143 | override fun processMapList(map: ListenerMapList?) {
144 | listener.processedMapList( map )
145 | }
146 |
147 | override fun processedStringMap(map: StringMap?) {
148 | System.out.println("StringMapList: "+map!!)
149 | }
150 |
151 | override fun processedStringMapList(map: StringMapList?) {
152 | System.out.println("StringMap: "+map!!)
153 | }
154 |
155 | override fun throwException(): Double {
156 | throw Exception("Java test exception")
157 | }
158 |
159 | override fun debug(msg: String): Array {
160 | System.out.println("Swift: " + msg)
161 | return arrayOf("!" + msg, msg + "!")
162 | }
163 |
164 | override fun onMainThread(runnable: Runnable?) {
165 | runOnUiThread(runnable)
166 | }
167 |
168 | override fun testResponder(loopback: Int): TestListener {
169 | val test = SwiftTestListener()
170 | if ( loopback > 0 ) {
171 | test.setLoopback( listener.testResponder(loopback - 1 ) )
172 | }
173 | return test
174 | }
175 |
176 | companion object {
177 |
178 | internal lateinit var listener: Listener
179 |
180 | private fun loadNativeDependencies() {
181 | // Load libraries
182 | System.loadLibrary("swifthello")
183 | }
184 | }
185 | }
186 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/user/myapplication/SwiftApp.kt:
--------------------------------------------------------------------------------
1 | package com.example.user.myapplication
2 |
3 | import android.app.Application
4 |
5 | class SwiftApp : Application() {
6 |
7 | override fun onCreate() {
8 | super.onCreate()
9 | sharedApplication = this
10 | }
11 |
12 | companion object {
13 |
14 | lateinit var sharedApplication: Application
15 | private set
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/johnholdsworth/swiftbindings/SwiftHelloBinding.java:
--------------------------------------------------------------------------------
1 |
2 | package com.johnholdsworth.swiftbindings;
3 |
4 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.TextListener;
5 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap;
6 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList;
7 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMap;
8 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMapList;
9 |
10 | public interface SwiftHelloBinding {
11 |
12 | // Messages from JavaActivity to Swift
13 | public interface Listener {
14 |
15 | public void setCacheDir( String cacheDir );
16 |
17 | public void processNumber( double number );
18 |
19 | public void processText( String text );
20 |
21 | public void processedMap( ListenerMap map );
22 |
23 | public void processedMapList( ListenerMapList map );
24 |
25 | public void processStringMap( StringMap map );
26 |
27 | public void processStringMapList( StringMapList map );
28 |
29 | public double throwException() throws Exception;
30 |
31 | public SwiftHelloTest.TestListener testResponder( int loopback );
32 |
33 | }
34 |
35 | // Messages from Swift back to Activity
36 | public interface Responder {
37 |
38 | public void processedNumber( double number );
39 |
40 | public void processedText( String text );
41 |
42 | public void processedTextListener( TextListener text );
43 |
44 | public void processedTextListenerArray( TextListener text[] );
45 |
46 | public void processedTextListener2dArray( TextListener text[][] );
47 |
48 | public void processMap( ListenerMap map );
49 |
50 | public void processMapList( ListenerMapList map );
51 |
52 | public void processedStringMap( StringMap map );
53 |
54 | public void processedStringMapList( StringMapList map );
55 |
56 | public double throwException() throws Exception;
57 |
58 | public String[] debug( String msg );
59 |
60 | public void onMainThread( Runnable runnable );
61 |
62 | public SwiftHelloTest.TestListener testResponder( int loopback );
63 |
64 | }
65 |
66 | }
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/johnholdsworth/swiftbindings/SwiftHelloTest.java:
--------------------------------------------------------------------------------
1 |
2 | // auto generated by ../../../../gentests.rb
3 |
4 | package com.johnholdsworth.swiftbindings;
5 |
6 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.TextListener;
7 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap;
8 | import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList;
9 |
10 | public interface SwiftHelloTest {
11 |
12 | public interface TestListener {
13 |
14 | public void setLoopback( TestListener loopback );
15 |
16 | public boolean booleanMethod( boolean arg );
17 | public boolean[] booleanArrayMethod( boolean arg[] );
18 | public boolean[][] boolean2dArrayMethod( boolean arg[][] );
19 |
20 | public byte byteMethod( byte arg );
21 | public byte[] byteArrayMethod( byte arg[] );
22 | public byte[][] byte2dArrayMethod( byte arg[][] );
23 |
24 | public char charMethod( char arg );
25 | public char[] charArrayMethod( char arg[] );
26 | public char[][] char2dArrayMethod( char arg[][] );
27 |
28 | public short shortMethod( short arg );
29 | public short[] shortArrayMethod( short arg[] );
30 | public short[][] short2dArrayMethod( short arg[][] );
31 |
32 | public int intMethod( int arg );
33 | public int[] intArrayMethod( int arg[] );
34 | public int[][] int2dArrayMethod( int arg[][] );
35 |
36 | public long longMethod( long arg );
37 | public long[] longArrayMethod( long arg[] );
38 | public long[][] long2dArrayMethod( long arg[][] );
39 |
40 | public float floatMethod( float arg );
41 | public float[] floatArrayMethod( float arg[] );
42 | public float[][] float2dArrayMethod( float arg[][] );
43 |
44 | public double doubleMethod( double arg );
45 | public double[] doubleArrayMethod( double arg[] );
46 | public double[][] double2dArrayMethod( double arg[][] );
47 |
48 | public String StringMethod( String arg );
49 | public String[] StringArrayMethod( String arg[] );
50 | public String[][] String2dArrayMethod( String arg[][] );
51 |
52 | public TestListener TestListenerMethod( TestListener arg );
53 | public TestListener[] TestListenerArrayMethod( TestListener arg[] );
54 | public TestListener[][] TestListener2dArrayMethod( TestListener arg[][] );
55 |
56 | public ListenerMap testMap( ListenerMap arg );
57 | public ListenerMapList testMapList( ListenerMapList arg );
58 |
59 | }
60 |
61 | public static class TestResponderAdapter implements TestListener {
62 |
63 | public TestListener loopback;
64 |
65 | public void setLoopback( TestListener loopback ) {
66 | this.loopback = loopback;
67 | }
68 |
69 | public boolean booleanMethod( boolean arg ) {
70 | return loopback != null ? loopback.booleanMethod( arg ) : arg;
71 | }
72 |
73 | public boolean[] booleanArrayMethod( boolean arg[] ) {
74 | return loopback != null ? loopback.booleanArrayMethod( arg ) : arg;
75 | }
76 |
77 | public boolean[][] boolean2dArrayMethod( boolean arg[][] ) {
78 | return loopback != null ? loopback.boolean2dArrayMethod( arg ) : arg;
79 | }
80 |
81 | public byte byteMethod( byte arg ) {
82 | return loopback != null ? loopback.byteMethod( arg ) : arg;
83 | }
84 |
85 | public byte[] byteArrayMethod( byte arg[] ) {
86 | return loopback != null ? loopback.byteArrayMethod( arg ) : arg;
87 | }
88 |
89 | public byte[][] byte2dArrayMethod( byte arg[][] ) {
90 | return loopback != null ? loopback.byte2dArrayMethod( arg ) : arg;
91 | }
92 |
93 | public char charMethod( char arg ) {
94 | return loopback != null ? loopback.charMethod( arg ) : arg;
95 | }
96 |
97 | public char[] charArrayMethod( char arg[] ) {
98 | return loopback != null ? loopback.charArrayMethod( arg ) : arg;
99 | }
100 |
101 | public char[][] char2dArrayMethod( char arg[][] ) {
102 | return loopback != null ? loopback.char2dArrayMethod( arg ) : arg;
103 | }
104 |
105 | public short shortMethod( short arg ) {
106 | return loopback != null ? loopback.shortMethod( arg ) : arg;
107 | }
108 |
109 | public short[] shortArrayMethod( short arg[] ) {
110 | return loopback != null ? loopback.shortArrayMethod( arg ) : arg;
111 | }
112 |
113 | public short[][] short2dArrayMethod( short arg[][] ) {
114 | return loopback != null ? loopback.short2dArrayMethod( arg ) : arg;
115 | }
116 |
117 | public int intMethod( int arg ) {
118 | return loopback != null ? loopback.intMethod( arg ) : arg;
119 | }
120 |
121 | public int[] intArrayMethod( int arg[] ) {
122 | return loopback != null ? loopback.intArrayMethod( arg ) : arg;
123 | }
124 |
125 | public int[][] int2dArrayMethod( int arg[][] ) {
126 | return loopback != null ? loopback.int2dArrayMethod( arg ) : arg;
127 | }
128 |
129 | public long longMethod( long arg ) {
130 | return loopback != null ? loopback.longMethod( arg ) : arg;
131 | }
132 |
133 | public long[] longArrayMethod( long arg[] ) {
134 | return loopback != null ? loopback.longArrayMethod( arg ) : arg;
135 | }
136 |
137 | public long[][] long2dArrayMethod( long arg[][] ) {
138 | return loopback != null ? loopback.long2dArrayMethod( arg ) : arg;
139 | }
140 |
141 | public float floatMethod( float arg ) {
142 | return loopback != null ? loopback.floatMethod( arg ) : arg;
143 | }
144 |
145 | public float[] floatArrayMethod( float arg[] ) {
146 | return loopback != null ? loopback.floatArrayMethod( arg ) : arg;
147 | }
148 |
149 | public float[][] float2dArrayMethod( float arg[][] ) {
150 | return loopback != null ? loopback.float2dArrayMethod( arg ) : arg;
151 | }
152 |
153 | public double doubleMethod( double arg ) {
154 | return loopback != null ? loopback.doubleMethod( arg ) : arg;
155 | }
156 |
157 | public double[] doubleArrayMethod( double arg[] ) {
158 | return loopback != null ? loopback.doubleArrayMethod( arg ) : arg;
159 | }
160 |
161 | public double[][] double2dArrayMethod( double arg[][] ) {
162 | return loopback != null ? loopback.double2dArrayMethod( arg ) : arg;
163 | }
164 |
165 | public String StringMethod( String arg ) {
166 | return loopback != null ? loopback.StringMethod( arg ) : arg;
167 | }
168 |
169 | public String[] StringArrayMethod( String arg[] ) {
170 | return loopback != null ? loopback.StringArrayMethod( arg ) : arg;
171 | }
172 |
173 | public String[][] String2dArrayMethod( String arg[][] ) {
174 | return loopback != null ? loopback.String2dArrayMethod( arg ) : arg;
175 | }
176 |
177 | public TestListener TestListenerMethod( TestListener arg ) {
178 | return loopback != null ? loopback.TestListenerMethod( arg ) : arg;
179 | }
180 |
181 | public TestListener[] TestListenerArrayMethod( TestListener arg[] ) {
182 | return loopback != null ? loopback.TestListenerArrayMethod( arg ) : arg;
183 | }
184 |
185 | public TestListener[][] TestListener2dArrayMethod( TestListener arg[][] ) {
186 | return loopback != null ? loopback.TestListener2dArrayMethod( arg ) : arg;
187 | }
188 |
189 | public ListenerMap testMap( ListenerMap arg ) {
190 | return loopback != null ? loopback.testMap( arg ) : arg;
191 | }
192 |
193 | public ListenerMapList testMapList( ListenerMapList arg ) {
194 | return loopback != null ? loopback.testMapList( arg ) : arg;
195 | }
196 |
197 | }
198 |
199 | public static class SwiftTestListener extends TestResponderAdapter {
200 |
201 | static int tcount = 0;
202 |
203 | public void respond( TestListener responder ) {
204 | tcount += 1;
205 | System.out.println("Java -> Swift "+tcount+"...");
206 |
207 |
208 | if ( true ) {
209 | boolean reference = true;
210 | boolean referenceArray[] = new boolean [] {reference};
211 | boolean reference2dArray[][] = new boolean [][] {referenceArray};
212 |
213 | boolean response = responder.booleanMethod( reference );
214 | boolean responseArray[] = responder.booleanArrayMethod( referenceArray );
215 | boolean response2dArray[][] = responder.boolean2dArrayMethod( reference2dArray );
216 |
217 | if ( response != reference ) {
218 | System.out.println("Bool: "+response+" != "+reference);
219 | }
220 | if ( responseArray[0] != referenceArray[0] ) {
221 | System.out.println("Bool: "+responseArray[0]+" != "+referenceArray[0]);
222 | }
223 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
224 | System.out.println("Bool: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
225 | }
226 | }
227 |
228 | if ( true ) {
229 | byte reference = 123;
230 | byte referenceArray[] = new byte [] {reference};
231 | byte reference2dArray[][] = new byte [][] {referenceArray};
232 |
233 | byte response = responder.byteMethod( reference );
234 | byte responseArray[] = responder.byteArrayMethod( referenceArray );
235 | byte response2dArray[][] = responder.byte2dArrayMethod( reference2dArray );
236 |
237 | if ( response != reference ) {
238 | System.out.println("Int8: "+response+" != "+reference);
239 | }
240 | if ( responseArray[0] != referenceArray[0] ) {
241 | System.out.println("Int8: "+responseArray[0]+" != "+referenceArray[0]);
242 | }
243 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
244 | System.out.println("Int8: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
245 | }
246 | }
247 |
248 | if ( true ) {
249 | char reference = 123;
250 | char referenceArray[] = new char [] {reference};
251 | char reference2dArray[][] = new char [][] {referenceArray};
252 |
253 | char response = responder.charMethod( reference );
254 | char responseArray[] = responder.charArrayMethod( referenceArray );
255 | char response2dArray[][] = responder.char2dArrayMethod( reference2dArray );
256 |
257 | if ( response != reference ) {
258 | System.out.println("UInt16: "+response+" != "+reference);
259 | }
260 | if ( responseArray[0] != referenceArray[0] ) {
261 | System.out.println("UInt16: "+responseArray[0]+" != "+referenceArray[0]);
262 | }
263 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
264 | System.out.println("UInt16: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
265 | }
266 | }
267 |
268 | if ( true ) {
269 | short reference = 123;
270 | short referenceArray[] = new short [] {reference};
271 | short reference2dArray[][] = new short [][] {referenceArray};
272 |
273 | short response = responder.shortMethod( reference );
274 | short responseArray[] = responder.shortArrayMethod( referenceArray );
275 | short response2dArray[][] = responder.short2dArrayMethod( reference2dArray );
276 |
277 | if ( response != reference ) {
278 | System.out.println("Int16: "+response+" != "+reference);
279 | }
280 | if ( responseArray[0] != referenceArray[0] ) {
281 | System.out.println("Int16: "+responseArray[0]+" != "+referenceArray[0]);
282 | }
283 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
284 | System.out.println("Int16: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
285 | }
286 | }
287 |
288 | if ( true ) {
289 | int reference = 123;
290 | int referenceArray[] = new int [] {reference};
291 | int reference2dArray[][] = new int [][] {referenceArray};
292 |
293 | int response = responder.intMethod( reference );
294 | int responseArray[] = responder.intArrayMethod( referenceArray );
295 | int response2dArray[][] = responder.int2dArrayMethod( reference2dArray );
296 |
297 | if ( response != reference ) {
298 | System.out.println("Int: "+response+" != "+reference);
299 | }
300 | if ( responseArray[0] != referenceArray[0] ) {
301 | System.out.println("Int: "+responseArray[0]+" != "+referenceArray[0]);
302 | }
303 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
304 | System.out.println("Int: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
305 | }
306 | }
307 |
308 | if ( true ) {
309 | long reference = 123;
310 | long referenceArray[] = new long [] {reference};
311 | long reference2dArray[][] = new long [][] {referenceArray};
312 |
313 | long response = responder.longMethod( reference );
314 | long responseArray[] = responder.longArrayMethod( referenceArray );
315 | long response2dArray[][] = responder.long2dArrayMethod( reference2dArray );
316 |
317 | if ( response != reference ) {
318 | System.out.println("Int64: "+response+" != "+reference);
319 | }
320 | if ( responseArray[0] != referenceArray[0] ) {
321 | System.out.println("Int64: "+responseArray[0]+" != "+referenceArray[0]);
322 | }
323 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
324 | System.out.println("Int64: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
325 | }
326 | }
327 |
328 | if ( true ) {
329 | float reference = 123;
330 | float referenceArray[] = new float [] {reference};
331 | float reference2dArray[][] = new float [][] {referenceArray};
332 |
333 | float response = responder.floatMethod( reference );
334 | float responseArray[] = responder.floatArrayMethod( referenceArray );
335 | float response2dArray[][] = responder.float2dArrayMethod( reference2dArray );
336 |
337 | if ( response != reference ) {
338 | System.out.println("Float: "+response+" != "+reference);
339 | }
340 | if ( responseArray[0] != referenceArray[0] ) {
341 | System.out.println("Float: "+responseArray[0]+" != "+referenceArray[0]);
342 | }
343 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
344 | System.out.println("Float: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
345 | }
346 | }
347 |
348 | if ( true ) {
349 | double reference = 123;
350 | double referenceArray[] = new double [] {reference};
351 | double reference2dArray[][] = new double [][] {referenceArray};
352 |
353 | double response = responder.doubleMethod( reference );
354 | double responseArray[] = responder.doubleArrayMethod( referenceArray );
355 | double response2dArray[][] = responder.double2dArrayMethod( reference2dArray );
356 |
357 | if ( response != reference ) {
358 | System.out.println("Double: "+response+" != "+reference);
359 | }
360 | if ( responseArray[0] != referenceArray[0] ) {
361 | System.out.println("Double: "+responseArray[0]+" != "+referenceArray[0]);
362 | }
363 | if ( response2dArray[0][0] != reference2dArray[0][0] ) {
364 | System.out.println("Double: "+response2dArray[0][0]+" != "+reference2dArray[0][0]);
365 | }
366 | }
367 |
368 | if ( true ) {
369 | String reference = "123";
370 | String referenceArray[] = new String [] {reference};
371 | String reference2dArray[][] = new String [][] {referenceArray};
372 |
373 | String response = responder.StringMethod( reference );
374 | String responseArray[] = responder.StringArrayMethod( referenceArray );
375 | String response2dArray[][] = responder.String2dArrayMethod( reference2dArray );
376 | }
377 |
378 | if ( true ) {
379 | TestListener reference = new SwiftTestListener();
380 | TestListener referenceArray[] = new TestListener [] {reference};
381 | TestListener reference2dArray[][] = new TestListener [][] {referenceArray};
382 |
383 | TestListener response = responder.TestListenerMethod( reference );
384 | TestListener responseArray[] = responder.TestListenerArrayMethod( referenceArray );
385 | TestListener response2dArray[][] = responder.TestListener2dArrayMethod( reference2dArray );
386 | }
387 | }
388 |
389 | }
390 |
391 | }
392 |
--------------------------------------------------------------------------------
/app/src/main/java/com/johnholdsworth/swiftbindings/SwiftHelloTypes.java:
--------------------------------------------------------------------------------
1 |
2 | // Shared types/interfaces between Java and Swift in example applications
3 |
4 | package com.johnholdsworth.swiftbindings;
5 |
6 | import java.util.Map;
7 | import java.util.HashMap;
8 |
9 | public interface SwiftHelloTypes {
10 |
11 | // An example of publishing an object to Java.
12 | // Add the associated protocol to an class and
13 | // objects can be passed to a responder message.
14 | public interface TextListener {
15 | public String getText();
16 | }
17 |
18 | // These are required because of type erasure in Java jars
19 | public static class ListenerMap extends HashMap {
20 | public static Class> valueClass() {
21 | return TextListener.class;
22 | }
23 | }
24 |
25 | public static class ListenerMapList extends HashMap {
26 | public static Class> valueClass() {
27 | return (new TextListener [] {}).getClass();
28 | }
29 | }
30 |
31 | public static class StringMap extends HashMap {
32 | public static Class> valueClass() {
33 | return String.class;
34 | }
35 | public StringMap() {
36 | super();
37 | }
38 | @SuppressWarnings("unchecked")
39 | public StringMap(Map map) {
40 | super(map);
41 | }
42 | }
43 |
44 | public static class StringMapList extends HashMap {
45 | public static Class> valueClass() {
46 | return (new String [] {}).getClass();
47 | }
48 | public StringMapList() {
49 | super();
50 | }
51 | @SuppressWarnings("unchecked")
52 | public StringMapList(Map map) {
53 | super(map);
54 | }
55 | }
56 |
57 | public static enum Planet {
58 | MERCURY (3.303e+23, 2.4397e6),
59 | VENUS (4.869e+24, 6.0518e6),
60 | EARTH (5.976e+24, 6.37814e6),
61 | MARS (6.421e+23, 3.3972e6),
62 | JUPITER (1.9e+27, 7.1492e7),
63 | SATURN (5.688e+26, 6.0268e7),
64 | URANUS (8.686e+25, 2.5559e7),
65 | NEPTUNE (1.024e+26, 2.4746e7);
66 |
67 | private final double mass; // in kilograms
68 | private final double radius; // in meters
69 | Planet(double mass, double radius) {
70 | this.mass = mass;
71 | this.radius = radius;
72 | }
73 | public double mass() { return mass; }
74 | public double radius() { return radius; }
75 |
76 | // universal gravitational constant (m3 kg-1 s-2)
77 | public static final double G = 6.67300E-11;
78 |
79 | public double surfaceGravity() {
80 | return G * mass / (radius * radius);
81 | }
82 | public double surfaceWeight(double otherMass) {
83 | return otherMass * surfaceGravity();
84 | }
85 | }
86 | }
87 |
88 |
89 |
--------------------------------------------------------------------------------
/app/src/main/java/org/swiftjava/com_johnholdsworth/SwiftHelloBinding_ListenerProxy.java:
--------------------------------------------------------------------------------
1 |
2 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
3 |
4 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener ///
5 |
6 | package org.swiftjava.com_johnholdsworth;
7 |
8 | @SuppressWarnings("JniMissingFunction")
9 | public class SwiftHelloBinding_ListenerProxy implements com.johnholdsworth.swiftbindings.SwiftHelloBinding.Listener {
10 |
11 | // address of proxy object
12 | long __swiftObject;
13 |
14 | SwiftHelloBinding_ListenerProxy( long __swiftObject ) {
15 | this.__swiftObject = __swiftObject;
16 | }
17 |
18 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processNumber(double)
19 |
20 | public native void __processNumber( long __swiftObject, double number );
21 |
22 | public void processNumber( double number ) {
23 | __processNumber( __swiftObject, number );
24 | }
25 |
26 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap)
27 |
28 | public native void __processStringMap( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMap map );
29 |
30 | public void processStringMap( com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMap map ) {
31 | __processStringMap( __swiftObject, map );
32 | }
33 |
34 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList)
35 |
36 | public native void __processStringMapList( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMapList map );
37 |
38 | public void processStringMapList( com.johnholdsworth.swiftbindings.SwiftHelloTypes.StringMapList map ) {
39 | __processStringMapList( __swiftObject, map );
40 | }
41 |
42 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processText(java.lang.String)
43 |
44 | public native void __processText( long __swiftObject, java.lang.String text );
45 |
46 | public void processText( java.lang.String text ) {
47 | __processText( __swiftObject, text );
48 | }
49 |
50 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap)
51 |
52 | public native void __processedMap( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap map );
53 |
54 | public void processedMap( com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap map ) {
55 | __processedMap( __swiftObject, map );
56 | }
57 |
58 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList)
59 |
60 | public native void __processedMapList( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList map );
61 |
62 | public void processedMapList( com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList map ) {
63 | __processedMapList( __swiftObject, map );
64 | }
65 |
66 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.setCacheDir(java.lang.String)
67 |
68 | public native void __setCacheDir( long __swiftObject, java.lang.String cacheDir );
69 |
70 | public void setCacheDir( java.lang.String cacheDir ) {
71 | __setCacheDir( __swiftObject, cacheDir );
72 | }
73 |
74 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.testResponder(int)
75 |
76 | public native com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener __testResponder( long __swiftObject, int loopback );
77 |
78 | public com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener testResponder( int loopback ) {
79 | return __testResponder( __swiftObject, loopback );
80 | }
81 |
82 | /// public abstract double com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.throwException() throws java.lang.Exception
83 |
84 | public native double __throwException( long __swiftObject );
85 |
86 | public double throwException() throws java.lang.Exception {
87 | return __throwException( __swiftObject );
88 | }
89 |
90 | public native void __finalize( long __swiftObject );
91 |
92 | public void finalize() {
93 | __finalize( __swiftObject );
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/org/swiftjava/com_johnholdsworth/SwiftHelloTest_TestListenerProxy.java:
--------------------------------------------------------------------------------
1 |
2 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
3 |
4 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener ///
5 |
6 | package org.swiftjava.com_johnholdsworth;
7 |
8 | @SuppressWarnings("JniMissingFunction")
9 | public class SwiftHelloTest_TestListenerProxy implements com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener {
10 |
11 | // address of proxy object
12 | long __swiftObject;
13 |
14 | SwiftHelloTest_TestListenerProxy( long __swiftObject ) {
15 | this.__swiftObject = __swiftObject;
16 | }
17 |
18 | /// public abstract java.lang.String[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.String2dArrayMethod(java.lang.String[][])
19 |
20 | public native java.lang.String[][] __String2dArrayMethod( long __swiftObject, java.lang.String[][] arg );
21 |
22 | public java.lang.String[][] String2dArrayMethod( java.lang.String[][] arg ) {
23 | return __String2dArrayMethod( __swiftObject, arg );
24 | }
25 |
26 | /// public abstract java.lang.String[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.StringArrayMethod(java.lang.String[])
27 |
28 | public native java.lang.String[] __StringArrayMethod( long __swiftObject, java.lang.String[] arg );
29 |
30 | public java.lang.String[] StringArrayMethod( java.lang.String[] arg ) {
31 | return __StringArrayMethod( __swiftObject, arg );
32 | }
33 |
34 | /// public abstract java.lang.String com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.StringMethod(java.lang.String)
35 |
36 | public native java.lang.String __StringMethod( long __swiftObject, java.lang.String arg );
37 |
38 | public java.lang.String StringMethod( java.lang.String arg ) {
39 | return __StringMethod( __swiftObject, arg );
40 | }
41 |
42 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.TestListener2dArrayMethod(com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener[][])
43 |
44 | public native com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[][] __TestListener2dArrayMethod( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[][] arg );
45 |
46 | public com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[][] TestListener2dArrayMethod( com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[][] arg ) {
47 | return __TestListener2dArrayMethod( __swiftObject, arg );
48 | }
49 |
50 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.TestListenerArrayMethod(com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener[])
51 |
52 | public native com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[] __TestListenerArrayMethod( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[] arg );
53 |
54 | public com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[] TestListenerArrayMethod( com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener[] arg ) {
55 | return __TestListenerArrayMethod( __swiftObject, arg );
56 | }
57 |
58 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.TestListenerMethod(com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener)
59 |
60 | public native com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener __TestListenerMethod( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener arg );
61 |
62 | public com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener TestListenerMethod( com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener arg ) {
63 | return __TestListenerMethod( __swiftObject, arg );
64 | }
65 |
66 | /// public abstract boolean[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.boolean2dArrayMethod(boolean[][])
67 |
68 | public native boolean[][] __boolean2dArrayMethod( long __swiftObject, boolean[][] arg );
69 |
70 | public boolean[][] boolean2dArrayMethod( boolean[][] arg ) {
71 | return __boolean2dArrayMethod( __swiftObject, arg );
72 | }
73 |
74 | /// public abstract boolean[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.booleanArrayMethod(boolean[])
75 |
76 | public native boolean[] __booleanArrayMethod( long __swiftObject, boolean[] arg );
77 |
78 | public boolean[] booleanArrayMethod( boolean[] arg ) {
79 | return __booleanArrayMethod( __swiftObject, arg );
80 | }
81 |
82 | /// public abstract boolean com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.booleanMethod(boolean)
83 |
84 | public native boolean __booleanMethod( long __swiftObject, boolean arg );
85 |
86 | public boolean booleanMethod( boolean arg ) {
87 | return __booleanMethod( __swiftObject, arg );
88 | }
89 |
90 | /// public abstract byte[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.byte2dArrayMethod(byte[][])
91 |
92 | public native byte[][] __byte2dArrayMethod( long __swiftObject, byte[][] arg );
93 |
94 | public byte[][] byte2dArrayMethod( byte[][] arg ) {
95 | return __byte2dArrayMethod( __swiftObject, arg );
96 | }
97 |
98 | /// public abstract byte[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.byteArrayMethod(byte[])
99 |
100 | public native byte[] __byteArrayMethod( long __swiftObject, byte[] arg );
101 |
102 | public byte[] byteArrayMethod( byte[] arg ) {
103 | return __byteArrayMethod( __swiftObject, arg );
104 | }
105 |
106 | /// public abstract byte com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.byteMethod(byte)
107 |
108 | public native byte __byteMethod( long __swiftObject, byte arg );
109 |
110 | public byte byteMethod( byte arg ) {
111 | return __byteMethod( __swiftObject, arg );
112 | }
113 |
114 | /// public abstract char[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.char2dArrayMethod(char[][])
115 |
116 | public native char[][] __char2dArrayMethod( long __swiftObject, char[][] arg );
117 |
118 | public char[][] char2dArrayMethod( char[][] arg ) {
119 | return __char2dArrayMethod( __swiftObject, arg );
120 | }
121 |
122 | /// public abstract char[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.charArrayMethod(char[])
123 |
124 | public native char[] __charArrayMethod( long __swiftObject, char[] arg );
125 |
126 | public char[] charArrayMethod( char[] arg ) {
127 | return __charArrayMethod( __swiftObject, arg );
128 | }
129 |
130 | /// public abstract char com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.charMethod(char)
131 |
132 | public native char __charMethod( long __swiftObject, char arg );
133 |
134 | public char charMethod( char arg ) {
135 | return __charMethod( __swiftObject, arg );
136 | }
137 |
138 | /// public abstract double[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.double2dArrayMethod(double[][])
139 |
140 | public native double[][] __double2dArrayMethod( long __swiftObject, double[][] arg );
141 |
142 | public double[][] double2dArrayMethod( double[][] arg ) {
143 | return __double2dArrayMethod( __swiftObject, arg );
144 | }
145 |
146 | /// public abstract double[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.doubleArrayMethod(double[])
147 |
148 | public native double[] __doubleArrayMethod( long __swiftObject, double[] arg );
149 |
150 | public double[] doubleArrayMethod( double[] arg ) {
151 | return __doubleArrayMethod( __swiftObject, arg );
152 | }
153 |
154 | /// public abstract double com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.doubleMethod(double)
155 |
156 | public native double __doubleMethod( long __swiftObject, double arg );
157 |
158 | public double doubleMethod( double arg ) {
159 | return __doubleMethod( __swiftObject, arg );
160 | }
161 |
162 | /// public abstract float[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.float2dArrayMethod(float[][])
163 |
164 | public native float[][] __float2dArrayMethod( long __swiftObject, float[][] arg );
165 |
166 | public float[][] float2dArrayMethod( float[][] arg ) {
167 | return __float2dArrayMethod( __swiftObject, arg );
168 | }
169 |
170 | /// public abstract float[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.floatArrayMethod(float[])
171 |
172 | public native float[] __floatArrayMethod( long __swiftObject, float[] arg );
173 |
174 | public float[] floatArrayMethod( float[] arg ) {
175 | return __floatArrayMethod( __swiftObject, arg );
176 | }
177 |
178 | /// public abstract float com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.floatMethod(float)
179 |
180 | public native float __floatMethod( long __swiftObject, float arg );
181 |
182 | public float floatMethod( float arg ) {
183 | return __floatMethod( __swiftObject, arg );
184 | }
185 |
186 | /// public abstract int[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.int2dArrayMethod(int[][])
187 |
188 | public native int[][] __int2dArrayMethod( long __swiftObject, int[][] arg );
189 |
190 | public int[][] int2dArrayMethod( int[][] arg ) {
191 | return __int2dArrayMethod( __swiftObject, arg );
192 | }
193 |
194 | /// public abstract int[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.intArrayMethod(int[])
195 |
196 | public native int[] __intArrayMethod( long __swiftObject, int[] arg );
197 |
198 | public int[] intArrayMethod( int[] arg ) {
199 | return __intArrayMethod( __swiftObject, arg );
200 | }
201 |
202 | /// public abstract int com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.intMethod(int)
203 |
204 | public native int __intMethod( long __swiftObject, int arg );
205 |
206 | public int intMethod( int arg ) {
207 | return __intMethod( __swiftObject, arg );
208 | }
209 |
210 | /// public abstract long[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.long2dArrayMethod(long[][])
211 |
212 | public native long[][] __long2dArrayMethod( long __swiftObject, long[][] arg );
213 |
214 | public long[][] long2dArrayMethod( long[][] arg ) {
215 | return __long2dArrayMethod( __swiftObject, arg );
216 | }
217 |
218 | /// public abstract long[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.longArrayMethod(long[])
219 |
220 | public native long[] __longArrayMethod( long __swiftObject, long[] arg );
221 |
222 | public long[] longArrayMethod( long[] arg ) {
223 | return __longArrayMethod( __swiftObject, arg );
224 | }
225 |
226 | /// public abstract long com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.longMethod(long)
227 |
228 | public native long __longMethod( long __swiftObject, long arg );
229 |
230 | public long longMethod( long arg ) {
231 | return __longMethod( __swiftObject, arg );
232 | }
233 |
234 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.setLoopback(com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener)
235 |
236 | public native void __setLoopback( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener loopback );
237 |
238 | public void setLoopback( com.johnholdsworth.swiftbindings.SwiftHelloTest.TestListener loopback ) {
239 | __setLoopback( __swiftObject, loopback );
240 | }
241 |
242 | /// public abstract short[][] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.short2dArrayMethod(short[][])
243 |
244 | public native short[][] __short2dArrayMethod( long __swiftObject, short[][] arg );
245 |
246 | public short[][] short2dArrayMethod( short[][] arg ) {
247 | return __short2dArrayMethod( __swiftObject, arg );
248 | }
249 |
250 | /// public abstract short[] com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.shortArrayMethod(short[])
251 |
252 | public native short[] __shortArrayMethod( long __swiftObject, short[] arg );
253 |
254 | public short[] shortArrayMethod( short[] arg ) {
255 | return __shortArrayMethod( __swiftObject, arg );
256 | }
257 |
258 | /// public abstract short com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.shortMethod(short)
259 |
260 | public native short __shortMethod( long __swiftObject, short arg );
261 |
262 | public short shortMethod( short arg ) {
263 | return __shortMethod( __swiftObject, arg );
264 | }
265 |
266 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.testMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap)
267 |
268 | public native com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap __testMap( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap arg );
269 |
270 | public com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap testMap( com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap arg ) {
271 | return __testMap( __swiftObject, arg );
272 | }
273 |
274 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener.testMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList)
275 |
276 | public native com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList __testMapList( long __swiftObject, com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList arg );
277 |
278 | public com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList testMapList( com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList arg ) {
279 | return __testMapList( __swiftObject, arg );
280 | }
281 |
282 | public native void __finalize( long __swiftObject );
283 |
284 | public void finalize() {
285 | __finalize( __swiftObject );
286 | }
287 |
288 | }
289 |
--------------------------------------------------------------------------------
/app/src/main/java/org/swiftjava/com_johnholdsworth/SwiftHelloTypes_TextListenerProxy.java:
--------------------------------------------------------------------------------
1 |
2 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
3 |
4 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener ///
5 |
6 | package org.swiftjava.com_johnholdsworth;
7 |
8 | @SuppressWarnings("JniMissingFunction")
9 | public class SwiftHelloTypes_TextListenerProxy implements com.johnholdsworth.swiftbindings.SwiftHelloTypes.TextListener {
10 |
11 | // address of proxy object
12 | long __swiftObject;
13 |
14 | SwiftHelloTypes_TextListenerProxy( long __swiftObject ) {
15 | this.__swiftObject = __swiftObject;
16 | }
17 |
18 | /// public abstract java.lang.String com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener.getText()
19 |
20 | public native java.lang.String __getText( long __swiftObject );
21 |
22 | public java.lang.String getText() {
23 | return __getText( __swiftObject );
24 | }
25 |
26 | public native void __finalize( long __swiftObject );
27 |
28 | public void finalize() {
29 | __finalize( __swiftObject );
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/org/swiftjava/java_swift/RunnableProxy.java:
--------------------------------------------------------------------------------
1 |
2 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
3 |
4 | /// interface java.lang.Runnable ///
5 |
6 | package org.swiftjava.java_swift;
7 |
8 | @SuppressWarnings("JniMissingFunction")
9 | public class RunnableProxy implements java.lang.Runnable {
10 |
11 | // address of proxy object
12 | long __swiftObject;
13 |
14 | RunnableProxy( long __swiftObject ) {
15 | this.__swiftObject = __swiftObject;
16 | }
17 |
18 | /// public abstract void java.lang.Runnable.run()
19 |
20 | public native void __run( long __swiftObject );
21 |
22 | public void run() {
23 | __run( __swiftObject );
24 | }
25 |
26 | public native void __finalize( long __swiftObject );
27 |
28 | public void finalize() {
29 | __finalize( __swiftObject );
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | My Application
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/swift/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:4.0
2 | import PackageDescription
3 |
4 | let package = Package(
5 | name: "swifthello",
6 | products: [
7 | .library(name: "swifthello", type: .dynamic, targets: ["swifthello"])
8 | ],
9 | dependencies: [
10 | .package(url: "https://github.com/SwiftJava/java_swift.git", "2.1.1"..<"3.0.0"),
11 | .package(url: "https://github.com/SwiftJava/swift-android-sqlite.git", from: "1.0.0"),
12 | .package(url: "https://github.com/SwiftJava/Alamofire.git", from: "4.0.0"),
13 | ],
14 | targets: [
15 | .target(
16 | name: "swifthello",
17 | dependencies: ["java_swift", "Alamofire"],
18 | path: "Sources"
19 | ),
20 | ]
21 | )
22 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/Statics.swift:
--------------------------------------------------------------------------------
1 | //
2 | // "Static" i.e. non-instance level variables
3 | // placed in this file so they retain state
4 | // when other class files are "injected"
5 | //
6 |
7 | // link back to Java side of Application
8 | var responder: SwiftHelloBinding_ResponderForward!
9 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloBinding.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloBinding ///
7 |
8 | public protocol SwiftHelloBinding: JavaProtocol {
9 |
10 | }
11 |
12 |
13 | open class SwiftHelloBindingForward: JNIObjectForward, SwiftHelloBinding {
14 |
15 | private static var SwiftHelloBindingJNIClass: jclass?
16 |
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloBinding_Listener.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener ///
7 |
8 | public protocol SwiftHelloBinding_Listener: JavaProtocol {
9 |
10 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processNumber(double)
11 |
12 | func processNumber( number: Double )
13 |
14 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap)
15 |
16 | func processStringMap( map: [String:String]? )
17 |
18 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList)
19 |
20 | func processStringMapList( map: [String:[String]]? )
21 |
22 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processText(java.lang.String)
23 |
24 | func processText( text: String? )
25 |
26 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap)
27 |
28 | func processedMap( map: [String:SwiftHelloTypes_TextListener]? )
29 |
30 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList)
31 |
32 | func processedMapList( map: [String:[SwiftHelloTypes_TextListener]]? )
33 |
34 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.setCacheDir(java.lang.String)
35 |
36 | func setCacheDir( cacheDir: String? )
37 |
38 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.testResponder(int)
39 |
40 | func testResponder( loopback: Int ) -> SwiftHelloTest_TestListener!
41 |
42 | /// public abstract double com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.throwException() throws java.lang.Exception
43 |
44 | func throwException() throws /* java.lang.Exception */ -> Double
45 |
46 | }
47 |
48 |
49 | open class SwiftHelloBinding_ListenerForward: JNIObjectForward, SwiftHelloBinding_Listener {
50 |
51 | private static var SwiftHelloBinding_ListenerJNIClass: jclass?
52 |
53 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processNumber(double)
54 |
55 | private static var processNumber_MethodID_10: jmethodID?
56 |
57 | open func processNumber( number: Double ) {
58 | var __locals = [jobject]()
59 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
60 | __args[0] = jvalue( d: number )
61 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processNumber", methodSig: "(D)V", methodCache: &SwiftHelloBinding_ListenerForward.processNumber_MethodID_10, args: &__args, locals: &__locals )
62 | }
63 |
64 | open func processNumber( _ _number: Double ) {
65 | processNumber( number: _number )
66 | }
67 |
68 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap)
69 |
70 | private static var processStringMap_MethodID_11: jmethodID?
71 |
72 | open func processStringMap( map: [String:String]? ) {
73 | var __locals = [jobject]()
74 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
75 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap", locals: &__locals )
76 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processStringMap", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap;)V", methodCache: &SwiftHelloBinding_ListenerForward.processStringMap_MethodID_11, args: &__args, locals: &__locals )
77 | }
78 |
79 | open func processStringMap( _ _map: [String:String]? ) {
80 | processStringMap( map: _map )
81 | }
82 |
83 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList)
84 |
85 | private static var processStringMapList_MethodID_12: jmethodID?
86 |
87 | open func processStringMapList( map: [String:[String]]? ) {
88 | var __locals = [jobject]()
89 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
90 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList", locals: &__locals )
91 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processStringMapList", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList;)V", methodCache: &SwiftHelloBinding_ListenerForward.processStringMapList_MethodID_12, args: &__args, locals: &__locals )
92 | }
93 |
94 | open func processStringMapList( _ _map: [String:[String]]? ) {
95 | processStringMapList( map: _map )
96 | }
97 |
98 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processText(java.lang.String)
99 |
100 | private static var processText_MethodID_13: jmethodID?
101 |
102 | open func processText( text: String? ) {
103 | var __locals = [jobject]()
104 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
105 | __args[0] = JNIType.toJava( value: text, locals: &__locals )
106 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processText", methodSig: "(Ljava/lang/String;)V", methodCache: &SwiftHelloBinding_ListenerForward.processText_MethodID_13, args: &__args, locals: &__locals )
107 | }
108 |
109 | open func processText( _ _text: String? ) {
110 | processText( text: _text )
111 | }
112 |
113 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap)
114 |
115 | private static var processedMap_MethodID_14: jmethodID?
116 |
117 | open func processedMap( map: [String:SwiftHelloTypes_TextListener]? ) {
118 | var __locals = [jobject]()
119 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
120 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMap", locals: &__locals )
121 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedMap", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMap;)V", methodCache: &SwiftHelloBinding_ListenerForward.processedMap_MethodID_14, args: &__args, locals: &__locals )
122 | }
123 |
124 | open func processedMap( _ _map: [String:SwiftHelloTypes_TextListener]? ) {
125 | processedMap( map: _map )
126 | }
127 |
128 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList)
129 |
130 | private static var processedMapList_MethodID_15: jmethodID?
131 |
132 | open func processedMapList( map: [String:[SwiftHelloTypes_TextListener]]? ) {
133 | var __locals = [jobject]()
134 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
135 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMapList", locals: &__locals )
136 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedMapList", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMapList;)V", methodCache: &SwiftHelloBinding_ListenerForward.processedMapList_MethodID_15, args: &__args, locals: &__locals )
137 | }
138 |
139 | open func processedMapList( _ _map: [String:[SwiftHelloTypes_TextListener]]? ) {
140 | processedMapList( map: _map )
141 | }
142 |
143 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.setCacheDir(java.lang.String)
144 |
145 | private static var setCacheDir_MethodID_16: jmethodID?
146 |
147 | open func setCacheDir( cacheDir: String? ) {
148 | var __locals = [jobject]()
149 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
150 | __args[0] = JNIType.toJava( value: cacheDir, locals: &__locals )
151 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "setCacheDir", methodSig: "(Ljava/lang/String;)V", methodCache: &SwiftHelloBinding_ListenerForward.setCacheDir_MethodID_16, args: &__args, locals: &__locals )
152 | }
153 |
154 | open func setCacheDir( _ _cacheDir: String? ) {
155 | setCacheDir( cacheDir: _cacheDir )
156 | }
157 |
158 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.testResponder(int)
159 |
160 | private static var testResponder_MethodID_17: jmethodID?
161 |
162 | open func testResponder( loopback: Int ) -> SwiftHelloTest_TestListener! {
163 | var __locals = [jobject]()
164 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
165 | __args[0] = jvalue( i: jint(loopback) )
166 | let __return = JNIMethod.CallObjectMethod( object: javaObject, methodName: "testResponder", methodSig: "(I)Lcom/johnholdsworth/swiftbindings/SwiftHelloTest$TestListener;", methodCache: &SwiftHelloBinding_ListenerForward.testResponder_MethodID_17, args: &__args, locals: &__locals )
167 | defer { JNI.DeleteLocalRef( __return ) }
168 | return __return != nil ? SwiftHelloTest_TestListenerForward( javaObject: __return ) : nil
169 | }
170 |
171 | open func testResponder( _ _loopback: Int ) -> SwiftHelloTest_TestListener! {
172 | return testResponder( loopback: _loopback )
173 | }
174 |
175 | /// public abstract double com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.throwException() throws java.lang.Exception
176 |
177 | private static var throwException_MethodID_18: jmethodID?
178 |
179 | open func throwException() throws /* java.lang.Exception */ -> Double {
180 | var __locals = [jobject]()
181 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
182 | let __return = JNIMethod.CallDoubleMethod( object: javaObject, methodName: "throwException", methodSig: "()D", methodCache: &SwiftHelloBinding_ListenerForward.throwException_MethodID_18, args: &__args, locals: &__locals )
183 | if let throwable = JNI.ExceptionCheck() {
184 | defer { JNI.DeleteLocalRef( throwable ) }
185 | throw java_swift.Exception( javaObject: throwable )
186 | }
187 | return __return
188 | }
189 |
190 |
191 | }
192 |
193 | private typealias SwiftHelloBinding_Listener_processNumber_0_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jdouble ) -> ()
194 |
195 | private func SwiftHelloBinding_Listener_processNumber_0( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ number: jdouble ) -> () {
196 | SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).processNumber( number: number )
197 | }
198 |
199 | private typealias SwiftHelloBinding_Listener_processStringMap_1_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jobject? ) -> ()
200 |
201 | private func SwiftHelloBinding_Listener_processStringMap_1( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ map: jobject? ) -> () {
202 | SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).processStringMap( map: JNIType.toSwift( type: [String:String].self, from: map, consume: false ) )
203 | }
204 |
205 | private typealias SwiftHelloBinding_Listener_processStringMapList_2_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jobject? ) -> ()
206 |
207 | private func SwiftHelloBinding_Listener_processStringMapList_2( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ map: jobject? ) -> () {
208 | SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).processStringMapList( map: JNIType.toSwift( type: [String:[String]].self, from: map, consume: false ) )
209 | }
210 |
211 | private typealias SwiftHelloBinding_Listener_processText_3_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jobject? ) -> ()
212 |
213 | private func SwiftHelloBinding_Listener_processText_3( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ text: jobject? ) -> () {
214 | SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).processText( text: text != nil ? String( javaObject: text ) : nil )
215 | }
216 |
217 | private typealias SwiftHelloBinding_Listener_processedMap_4_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jobject? ) -> ()
218 |
219 | private func SwiftHelloBinding_Listener_processedMap_4( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ map: jobject? ) -> () {
220 | SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).processedMap( map: JNIType.toSwift( type: [String:SwiftHelloTypes_TextListenerForward].self, from: map, consume: false ) )
221 | }
222 |
223 | private typealias SwiftHelloBinding_Listener_processedMapList_5_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jobject? ) -> ()
224 |
225 | private func SwiftHelloBinding_Listener_processedMapList_5( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ map: jobject? ) -> () {
226 | SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).processedMapList( map: JNIType.toSwift( type: [String:[SwiftHelloTypes_TextListenerForward]].self, from: map, consume: false ) )
227 | }
228 |
229 | private typealias SwiftHelloBinding_Listener_setCacheDir_6_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jobject? ) -> ()
230 |
231 | private func SwiftHelloBinding_Listener_setCacheDir_6( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ cacheDir: jobject? ) -> () {
232 | SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).setCacheDir( cacheDir: cacheDir != nil ? String( javaObject: cacheDir ) : nil )
233 | }
234 |
235 | private typealias SwiftHelloBinding_Listener_testResponder_7_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong, _: jint ) -> jobject?
236 |
237 | private func SwiftHelloBinding_Listener_testResponder_7( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong, _ loopback: jint ) -> jobject? {
238 | let __return = SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).testResponder( loopback: Int(loopback) )
239 | var __locals = [jobject]()
240 | return JNI.check( JNIType.toJava( value: __return, locals: &__locals ).l, &__locals, removeLast: true )
241 | }
242 |
243 | private typealias SwiftHelloBinding_Listener_throwException_8_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong ) -> jdouble
244 |
245 | private func SwiftHelloBinding_Listener_throwException_8( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong ) -> jdouble {
246 | do {
247 | let __return = try SwiftHelloBinding_ListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).throwException( )
248 | var __locals = [jobject]()
249 | return JNI.check( jvalue( d: __return ).d, &__locals, removeLast: true )
250 | }
251 | catch let exception as Throwable {
252 | _ = exception.withJavaObject { JNI.api.Throw( JNI.env, $0 ) }
253 | return 0
254 | }
255 | catch {
256 | _ = Exception("Unknown exception").withJavaObject { JNI.api.Throw( JNI.env, $0 ) }
257 | return 0
258 | }
259 | }
260 |
261 | fileprivate class SwiftHelloBinding_ListenerLocal_: JNILocalProxy {
262 |
263 | fileprivate static let _proxyClass: jclass = {
264 | var natives = [JNINativeMethod]()
265 |
266 | let SwiftHelloBinding_Listener_processNumber_0_thunk: SwiftHelloBinding_Listener_processNumber_0_type = SwiftHelloBinding_Listener_processNumber_0
267 | natives.append( JNINativeMethod( name: strdup("__processNumber"), signature: strdup("(JD)V"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_processNumber_0_thunk, to: UnsafeMutableRawPointer.self ) ) )
268 |
269 | let SwiftHelloBinding_Listener_processStringMap_1_thunk: SwiftHelloBinding_Listener_processStringMap_1_type = SwiftHelloBinding_Listener_processStringMap_1
270 | natives.append( JNINativeMethod( name: strdup("__processStringMap"), signature: strdup("(JLcom/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap;)V"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_processStringMap_1_thunk, to: UnsafeMutableRawPointer.self ) ) )
271 |
272 | let SwiftHelloBinding_Listener_processStringMapList_2_thunk: SwiftHelloBinding_Listener_processStringMapList_2_type = SwiftHelloBinding_Listener_processStringMapList_2
273 | natives.append( JNINativeMethod( name: strdup("__processStringMapList"), signature: strdup("(JLcom/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList;)V"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_processStringMapList_2_thunk, to: UnsafeMutableRawPointer.self ) ) )
274 |
275 | let SwiftHelloBinding_Listener_processText_3_thunk: SwiftHelloBinding_Listener_processText_3_type = SwiftHelloBinding_Listener_processText_3
276 | natives.append( JNINativeMethod( name: strdup("__processText"), signature: strdup("(JLjava/lang/String;)V"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_processText_3_thunk, to: UnsafeMutableRawPointer.self ) ) )
277 |
278 | let SwiftHelloBinding_Listener_processedMap_4_thunk: SwiftHelloBinding_Listener_processedMap_4_type = SwiftHelloBinding_Listener_processedMap_4
279 | natives.append( JNINativeMethod( name: strdup("__processedMap"), signature: strdup("(JLcom/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMap;)V"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_processedMap_4_thunk, to: UnsafeMutableRawPointer.self ) ) )
280 |
281 | let SwiftHelloBinding_Listener_processedMapList_5_thunk: SwiftHelloBinding_Listener_processedMapList_5_type = SwiftHelloBinding_Listener_processedMapList_5
282 | natives.append( JNINativeMethod( name: strdup("__processedMapList"), signature: strdup("(JLcom/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMapList;)V"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_processedMapList_5_thunk, to: UnsafeMutableRawPointer.self ) ) )
283 |
284 | let SwiftHelloBinding_Listener_setCacheDir_6_thunk: SwiftHelloBinding_Listener_setCacheDir_6_type = SwiftHelloBinding_Listener_setCacheDir_6
285 | natives.append( JNINativeMethod( name: strdup("__setCacheDir"), signature: strdup("(JLjava/lang/String;)V"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_setCacheDir_6_thunk, to: UnsafeMutableRawPointer.self ) ) )
286 |
287 | let SwiftHelloBinding_Listener_testResponder_7_thunk: SwiftHelloBinding_Listener_testResponder_7_type = SwiftHelloBinding_Listener_testResponder_7
288 | natives.append( JNINativeMethod( name: strdup("__testResponder"), signature: strdup("(JI)Lcom/johnholdsworth/swiftbindings/SwiftHelloTest$TestListener;"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_testResponder_7_thunk, to: UnsafeMutableRawPointer.self ) ) )
289 |
290 | let SwiftHelloBinding_Listener_throwException_8_thunk: SwiftHelloBinding_Listener_throwException_8_type = SwiftHelloBinding_Listener_throwException_8
291 | natives.append( JNINativeMethod( name: strdup("__throwException"), signature: strdup("(J)D"), fnPtr: unsafeBitCast( SwiftHelloBinding_Listener_throwException_8_thunk, to: UnsafeMutableRawPointer.self ) ) )
292 |
293 | natives.append( JNINativeMethod( name: strdup("__finalize"), signature: strdup("(J)V"), fnPtr: unsafeBitCast( JNIReleasableProxy__finalize_thunk, to: UnsafeMutableRawPointer.self ) ) )
294 |
295 | let clazz = JNI.FindClass( proxyClassName() )
296 | withUnsafePointer(to: &natives[0]) {
297 | nativesPtr in
298 | if JNI.api.RegisterNatives( JNI.env, clazz, nativesPtr, jint(natives.count) ) != jint(JNI_OK) {
299 | JNI.report( "Unable to register java natives" )
300 | }
301 | }
302 |
303 | defer { JNI.DeleteLocalRef( clazz ) }
304 | return JNI.api.NewGlobalRef( JNI.env, clazz )!
305 | }()
306 |
307 | override open class func proxyClassName() -> String { return "org/swiftjava/com_johnholdsworth/SwiftHelloBinding_ListenerProxy" }
308 | override open class func proxyClass() -> jclass? { return _proxyClass }
309 |
310 | }
311 |
312 | extension SwiftHelloBinding_Listener {
313 |
314 | public func localJavaObject( _ locals: UnsafeMutablePointer<[jobject]> ) -> jobject? {
315 | return SwiftHelloBinding_ListenerLocal_( owned: self, proto: self ).localJavaObject( locals )
316 | }
317 |
318 | }
319 |
320 | open class SwiftHelloBinding_ListenerBase: SwiftHelloBinding_Listener {
321 |
322 | public init() {}
323 |
324 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processNumber(double)
325 |
326 | open func processNumber( number: Double ) /**/ {
327 | }
328 |
329 |
330 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap)
331 |
332 | open func processStringMap( map: [String:String]? ) /**/ {
333 | }
334 |
335 |
336 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processStringMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList)
337 |
338 | open func processStringMapList( map: [String:[String]]? ) /**/ {
339 | }
340 |
341 |
342 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processText(java.lang.String)
343 |
344 | open func processText( text: String? ) /**/ {
345 | }
346 |
347 |
348 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap)
349 |
350 | open func processedMap( map: [String:SwiftHelloTypes_TextListener]? ) /**/ {
351 | }
352 |
353 |
354 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.processedMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList)
355 |
356 | open func processedMapList( map: [String:[SwiftHelloTypes_TextListener]]? ) /**/ {
357 | }
358 |
359 |
360 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.setCacheDir(java.lang.String)
361 |
362 | open func setCacheDir( cacheDir: String? ) /**/ {
363 | }
364 |
365 |
366 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.testResponder(int)
367 |
368 | open func testResponder( loopback: Int ) -> SwiftHelloTest_TestListener! /**/ {
369 | return nil
370 | }
371 |
372 |
373 | /// public abstract double com.johnholdsworth.swiftbindings.SwiftHelloBinding$Listener.throwException() throws java.lang.Exception
374 |
375 | open func throwException() throws /* java.lang.Exception */ -> Double /**/ {
376 | return 0
377 | }
378 |
379 |
380 | }
381 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloBinding_Responder.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder ///
7 |
8 | public protocol SwiftHelloBinding_Responder: JavaProtocol {
9 |
10 | /// public abstract java.lang.String[] com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.debug(java.lang.String)
11 |
12 | func debug( msg: String? ) -> [String]!
13 |
14 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.onMainThread(java.lang.Runnable)
15 |
16 | func onMainThread( runnable: java_swift.Runnable? )
17 |
18 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap)
19 |
20 | func processMap( map: [String:SwiftHelloTypes_TextListener]? )
21 |
22 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList)
23 |
24 | func processMapList( map: [String:[SwiftHelloTypes_TextListener]]? )
25 |
26 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedNumber(double)
27 |
28 | func processedNumber( number: Double )
29 |
30 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedStringMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap)
31 |
32 | func processedStringMap( map: [String:String]? )
33 |
34 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedStringMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList)
35 |
36 | func processedStringMapList( map: [String:[String]]? )
37 |
38 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedText(java.lang.String)
39 |
40 | func processedText( text: String? )
41 |
42 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedTextListener(com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener)
43 |
44 | func processedTextListener( text: SwiftHelloTypes_TextListener? )
45 |
46 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedTextListener2dArray(com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener[][])
47 |
48 | func processedTextListener2dArray( text: [[SwiftHelloTypes_TextListener]]? )
49 |
50 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedTextListenerArray(com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener[])
51 |
52 | func processedTextListenerArray( text: [SwiftHelloTypes_TextListener]? )
53 |
54 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.testResponder(int)
55 |
56 | func testResponder( loopback: Int ) -> SwiftHelloTest_TestListener!
57 |
58 | /// public abstract double com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.throwException() throws java.lang.Exception
59 |
60 | func throwException() throws /* java.lang.Exception */ -> Double
61 |
62 | }
63 |
64 |
65 | open class SwiftHelloBinding_ResponderForward: JNIObjectForward, SwiftHelloBinding_Responder {
66 |
67 | private static var SwiftHelloBinding_ResponderJNIClass: jclass?
68 |
69 | /// public abstract java.lang.String[] com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.debug(java.lang.String)
70 |
71 | private static var debug_MethodID_14: jmethodID?
72 |
73 | open func debug( msg: String? ) -> [String]! {
74 | var __locals = [jobject]()
75 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
76 | __args[0] = JNIType.toJava( value: msg, locals: &__locals )
77 | let __return = JNIMethod.CallObjectMethod( object: javaObject, methodName: "debug", methodSig: "(Ljava/lang/String;)[Ljava/lang/String;", methodCache: &SwiftHelloBinding_ResponderForward.debug_MethodID_14, args: &__args, locals: &__locals )
78 | return JNIType.toSwift( type: [String].self, from: __return )
79 | }
80 |
81 | open func debug( _ _msg: String? ) -> [String]! {
82 | return debug( msg: _msg )
83 | }
84 |
85 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.onMainThread(java.lang.Runnable)
86 |
87 | private static var onMainThread_MethodID_15: jmethodID?
88 |
89 | open func onMainThread( runnable: java_swift.Runnable? ) {
90 | var __locals = [jobject]()
91 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
92 | __args[0] = JNIType.toJava( value: runnable, locals: &__locals )
93 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "onMainThread", methodSig: "(Ljava/lang/Runnable;)V", methodCache: &SwiftHelloBinding_ResponderForward.onMainThread_MethodID_15, args: &__args, locals: &__locals )
94 | }
95 |
96 | open func onMainThread( _ _runnable: java_swift.Runnable? ) {
97 | onMainThread( runnable: _runnable )
98 | }
99 |
100 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap)
101 |
102 | private static var processMap_MethodID_16: jmethodID?
103 |
104 | open func processMap( map: [String:SwiftHelloTypes_TextListener]? ) {
105 | var __locals = [jobject]()
106 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
107 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMap", locals: &__locals )
108 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processMap", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMap;)V", methodCache: &SwiftHelloBinding_ResponderForward.processMap_MethodID_16, args: &__args, locals: &__locals )
109 | }
110 |
111 | open func processMap( _ _map: [String:SwiftHelloTypes_TextListener]? ) {
112 | processMap( map: _map )
113 | }
114 |
115 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList)
116 |
117 | private static var processMapList_MethodID_17: jmethodID?
118 |
119 | open func processMapList( map: [String:[SwiftHelloTypes_TextListener]]? ) {
120 | var __locals = [jobject]()
121 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
122 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMapList", locals: &__locals )
123 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processMapList", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMapList;)V", methodCache: &SwiftHelloBinding_ResponderForward.processMapList_MethodID_17, args: &__args, locals: &__locals )
124 | }
125 |
126 | open func processMapList( _ _map: [String:[SwiftHelloTypes_TextListener]]? ) {
127 | processMapList( map: _map )
128 | }
129 |
130 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedNumber(double)
131 |
132 | private static var processedNumber_MethodID_18: jmethodID?
133 |
134 | open func processedNumber( number: Double ) {
135 | var __locals = [jobject]()
136 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
137 | __args[0] = jvalue( d: number )
138 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedNumber", methodSig: "(D)V", methodCache: &SwiftHelloBinding_ResponderForward.processedNumber_MethodID_18, args: &__args, locals: &__locals )
139 | }
140 |
141 | open func processedNumber( _ _number: Double ) {
142 | processedNumber( number: _number )
143 | }
144 |
145 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedStringMap(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap)
146 |
147 | private static var processedStringMap_MethodID_19: jmethodID?
148 |
149 | open func processedStringMap( map: [String:String]? ) {
150 | var __locals = [jobject]()
151 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
152 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap", locals: &__locals )
153 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedStringMap", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap;)V", methodCache: &SwiftHelloBinding_ResponderForward.processedStringMap_MethodID_19, args: &__args, locals: &__locals )
154 | }
155 |
156 | open func processedStringMap( _ _map: [String:String]? ) {
157 | processedStringMap( map: _map )
158 | }
159 |
160 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedStringMapList(com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList)
161 |
162 | private static var processedStringMapList_MethodID_20: jmethodID?
163 |
164 | open func processedStringMapList( map: [String:[String]]? ) {
165 | var __locals = [jobject]()
166 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
167 | __args[0] = JNIType.toJava( value: map, mapClass: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList", locals: &__locals )
168 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedStringMapList", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList;)V", methodCache: &SwiftHelloBinding_ResponderForward.processedStringMapList_MethodID_20, args: &__args, locals: &__locals )
169 | }
170 |
171 | open func processedStringMapList( _ _map: [String:[String]]? ) {
172 | processedStringMapList( map: _map )
173 | }
174 |
175 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedText(java.lang.String)
176 |
177 | private static var processedText_MethodID_21: jmethodID?
178 |
179 | open func processedText( text: String? ) {
180 | var __locals = [jobject]()
181 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
182 | __args[0] = JNIType.toJava( value: text, locals: &__locals )
183 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedText", methodSig: "(Ljava/lang/String;)V", methodCache: &SwiftHelloBinding_ResponderForward.processedText_MethodID_21, args: &__args, locals: &__locals )
184 | }
185 |
186 | open func processedText( _ _text: String? ) {
187 | processedText( text: _text )
188 | }
189 |
190 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedTextListener(com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener)
191 |
192 | private static var processedTextListener_MethodID_22: jmethodID?
193 |
194 | open func processedTextListener( text: SwiftHelloTypes_TextListener? ) {
195 | var __locals = [jobject]()
196 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
197 | __args[0] = JNIType.toJava( value: text, locals: &__locals )
198 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedTextListener", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$TextListener;)V", methodCache: &SwiftHelloBinding_ResponderForward.processedTextListener_MethodID_22, args: &__args, locals: &__locals )
199 | }
200 |
201 | open func processedTextListener( _ _text: SwiftHelloTypes_TextListener? ) {
202 | processedTextListener( text: _text )
203 | }
204 |
205 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedTextListener2dArray(com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener[][])
206 |
207 | private static var processedTextListener2dArray_MethodID_23: jmethodID?
208 |
209 | open func processedTextListener2dArray( text: [[SwiftHelloTypes_TextListener]]? ) {
210 | var __locals = [jobject]()
211 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
212 | __args[0] = JNIType.toJava( value: text, locals: &__locals )
213 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedTextListener2dArray", methodSig: "([[Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$TextListener;)V", methodCache: &SwiftHelloBinding_ResponderForward.processedTextListener2dArray_MethodID_23, args: &__args, locals: &__locals )
214 | }
215 |
216 | open func processedTextListener2dArray( _ _text: [[SwiftHelloTypes_TextListener]]? ) {
217 | processedTextListener2dArray( text: _text )
218 | }
219 |
220 | /// public abstract void com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.processedTextListenerArray(com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener[])
221 |
222 | private static var processedTextListenerArray_MethodID_24: jmethodID?
223 |
224 | open func processedTextListenerArray( text: [SwiftHelloTypes_TextListener]? ) {
225 | var __locals = [jobject]()
226 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
227 | __args[0] = JNIType.toJava( value: text, locals: &__locals )
228 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "processedTextListenerArray", methodSig: "([Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$TextListener;)V", methodCache: &SwiftHelloBinding_ResponderForward.processedTextListenerArray_MethodID_24, args: &__args, locals: &__locals )
229 | }
230 |
231 | open func processedTextListenerArray( _ _text: [SwiftHelloTypes_TextListener]? ) {
232 | processedTextListenerArray( text: _text )
233 | }
234 |
235 | /// public abstract com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.testResponder(int)
236 |
237 | private static var testResponder_MethodID_25: jmethodID?
238 |
239 | open func testResponder( loopback: Int ) -> SwiftHelloTest_TestListener! {
240 | var __locals = [jobject]()
241 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
242 | __args[0] = jvalue( i: jint(loopback) )
243 | let __return = JNIMethod.CallObjectMethod( object: javaObject, methodName: "testResponder", methodSig: "(I)Lcom/johnholdsworth/swiftbindings/SwiftHelloTest$TestListener;", methodCache: &SwiftHelloBinding_ResponderForward.testResponder_MethodID_25, args: &__args, locals: &__locals )
244 | defer { JNI.DeleteLocalRef( __return ) }
245 | return __return != nil ? SwiftHelloTest_TestListenerForward( javaObject: __return ) : nil
246 | }
247 |
248 | open func testResponder( _ _loopback: Int ) -> SwiftHelloTest_TestListener! {
249 | return testResponder( loopback: _loopback )
250 | }
251 |
252 | /// public abstract double com.johnholdsworth.swiftbindings.SwiftHelloBinding$Responder.throwException() throws java.lang.Exception
253 |
254 | private static var throwException_MethodID_26: jmethodID?
255 |
256 | open func throwException() throws /* java.lang.Exception */ -> Double {
257 | var __locals = [jobject]()
258 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
259 | let __return = JNIMethod.CallDoubleMethod( object: javaObject, methodName: "throwException", methodSig: "()D", methodCache: &SwiftHelloBinding_ResponderForward.throwException_MethodID_26, args: &__args, locals: &__locals )
260 | if let throwable = JNI.ExceptionCheck() {
261 | defer { JNI.DeleteLocalRef( throwable ) }
262 | throw java_swift.Exception( javaObject: throwable )
263 | }
264 | return __return
265 | }
266 |
267 |
268 | }
269 |
270 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTest.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloTest ///
7 |
8 | public protocol SwiftHelloTest: JavaProtocol {
9 |
10 | }
11 |
12 |
13 | open class SwiftHelloTestForward: JNIObjectForward, SwiftHelloTest {
14 |
15 | private static var SwiftHelloTestJNIClass: jclass?
16 |
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTestImpl.swift:
--------------------------------------------------------------------------------
1 |
2 | // auto generated by ../../gentests.rb
3 |
4 | import java_swift
5 | import Foundation
6 |
7 | public class SwiftTestListener: SwiftHelloTest_TestListenerBase {
8 |
9 | var loopback: SwiftHelloTest_TestListener?
10 |
11 | override public func booleanMethod( arg: Bool ) -> Bool {
12 | return loopback?.booleanMethod( arg: arg ) ?? arg
13 | }
14 |
15 | override public func booleanArrayMethod( arg: [Bool]? ) -> [Bool]? {
16 | return loopback?.booleanArrayMethod( arg: arg ) ?? arg
17 | }
18 |
19 | override public func boolean2dArrayMethod( arg: [[Bool]]? ) -> [[Bool]]? {
20 | return loopback?.boolean2dArrayMethod( arg: arg ) ?? arg
21 | }
22 |
23 | override public func byteMethod( arg: Int8 ) -> Int8 {
24 | return loopback?.byteMethod( arg: arg ) ?? arg
25 | }
26 |
27 | override public func byteArrayMethod( arg: [Int8]? ) -> [Int8]? {
28 | return loopback?.byteArrayMethod( arg: arg ) ?? arg
29 | }
30 |
31 | override public func byte2dArrayMethod( arg: [[Int8]]? ) -> [[Int8]]? {
32 | return loopback?.byte2dArrayMethod( arg: arg ) ?? arg
33 | }
34 |
35 | override public func charMethod( arg: UInt16 ) -> UInt16 {
36 | return loopback?.charMethod( arg: arg ) ?? arg
37 | }
38 |
39 | override public func charArrayMethod( arg: [UInt16]? ) -> [UInt16]? {
40 | return loopback?.charArrayMethod( arg: arg ) ?? arg
41 | }
42 |
43 | override public func char2dArrayMethod( arg: [[UInt16]]? ) -> [[UInt16]]? {
44 | return loopback?.char2dArrayMethod( arg: arg ) ?? arg
45 | }
46 |
47 | override public func shortMethod( arg: Int16 ) -> Int16 {
48 | return loopback?.shortMethod( arg: arg ) ?? arg
49 | }
50 |
51 | override public func shortArrayMethod( arg: [Int16]? ) -> [Int16]? {
52 | return loopback?.shortArrayMethod( arg: arg ) ?? arg
53 | }
54 |
55 | override public func short2dArrayMethod( arg: [[Int16]]? ) -> [[Int16]]? {
56 | return loopback?.short2dArrayMethod( arg: arg ) ?? arg
57 | }
58 |
59 | override public func intMethod( arg: Int ) -> Int {
60 | return loopback?.intMethod( arg: arg ) ?? arg
61 | }
62 |
63 | override public func intArrayMethod( arg: [Int32]? ) -> [Int32]? {
64 | return loopback?.intArrayMethod( arg: arg ) ?? arg
65 | }
66 |
67 | override public func int2dArrayMethod( arg: [[Int32]]? ) -> [[Int32]]? {
68 | return loopback?.int2dArrayMethod( arg: arg ) ?? arg
69 | }
70 |
71 | override public func longMethod( arg: Int64 ) -> Int64 {
72 | return loopback?.longMethod( arg: arg ) ?? arg
73 | }
74 |
75 | override public func longArrayMethod( arg: [Int64]? ) -> [Int64]? {
76 | return loopback?.longArrayMethod( arg: arg ) ?? arg
77 | }
78 |
79 | override public func long2dArrayMethod( arg: [[Int64]]? ) -> [[Int64]]? {
80 | return loopback?.long2dArrayMethod( arg: arg ) ?? arg
81 | }
82 |
83 | override public func floatMethod( arg: Float ) -> Float {
84 | return loopback?.floatMethod( arg: arg ) ?? arg
85 | }
86 |
87 | override public func floatArrayMethod( arg: [Float]? ) -> [Float]? {
88 | return loopback?.floatArrayMethod( arg: arg ) ?? arg
89 | }
90 |
91 | override public func float2dArrayMethod( arg: [[Float]]? ) -> [[Float]]? {
92 | return loopback?.float2dArrayMethod( arg: arg ) ?? arg
93 | }
94 |
95 | override public func doubleMethod( arg: Double ) -> Double {
96 | return loopback?.doubleMethod( arg: arg ) ?? arg
97 | }
98 |
99 | override public func doubleArrayMethod( arg: [Double]? ) -> [Double]? {
100 | return loopback?.doubleArrayMethod( arg: arg ) ?? arg
101 | }
102 |
103 | override public func double2dArrayMethod( arg: [[Double]]? ) -> [[Double]]? {
104 | return loopback?.double2dArrayMethod( arg: arg ) ?? arg
105 | }
106 |
107 | override public func StringMethod( arg: String? ) -> String? {
108 | return loopback?.StringMethod( arg: arg ) ?? arg
109 | }
110 |
111 | override public func StringArrayMethod( arg: [String]? ) -> [String]? {
112 | return loopback?.StringArrayMethod( arg: arg ) ?? arg
113 | }
114 |
115 | override public func String2dArrayMethod( arg: [[String]]? ) -> [[String]]? {
116 | return loopback?.String2dArrayMethod( arg: arg ) ?? arg
117 | }
118 |
119 | override public func TestListenerMethod( arg: SwiftHelloTest_TestListener? ) -> SwiftHelloTest_TestListener? {
120 | return loopback?.TestListenerMethod( arg: arg ) ?? arg
121 | }
122 |
123 | override public func TestListenerArrayMethod( arg: [SwiftHelloTest_TestListener]? ) -> [SwiftHelloTest_TestListener]? {
124 | return loopback?.TestListenerArrayMethod( arg: arg ) ?? arg
125 | }
126 |
127 | override public func TestListener2dArrayMethod( arg: [[SwiftHelloTest_TestListener]]? ) -> [[SwiftHelloTest_TestListener]]? {
128 | return loopback?.TestListener2dArrayMethod( arg: arg ) ?? arg
129 | }
130 |
131 | }
132 |
133 | public class SwiftTestResponder {
134 |
135 | static var tcount = 0
136 |
137 | public func respond( to responder: SwiftHelloTest_TestListener ) {
138 | SwiftTestResponder.tcount += 1
139 | NSLog("Swift -> Java \(SwiftTestResponder.tcount)...")
140 |
141 | if true {
142 | let reference: Bool = true
143 | let referenceArray = [(reference)]
144 | let reference2dArray = [referenceArray]
145 |
146 | let response = responder.booleanMethod( arg: reference )
147 | let responseArray = responder.booleanArrayMethod( arg: referenceArray )!
148 | _ = responder.boolean2dArrayMethod( arg: reference2dArray )
149 |
150 | if response != reference {
151 | NSLog("Bool: \(String(describing: response)) != \(reference)")
152 | }
153 | if responseArray != referenceArray {
154 | NSLog("Bool: \(responseArray) != \(referenceArray)")
155 | }
156 | }
157 |
158 |
159 | if true {
160 | let reference: Int8 = 123
161 | let referenceArray = [(reference)]
162 | let reference2dArray = [referenceArray]
163 |
164 | let response = responder.byteMethod( arg: reference )
165 | let responseArray = responder.byteArrayMethod( arg: referenceArray )!
166 | _ = responder.byte2dArrayMethod( arg: reference2dArray )
167 |
168 | if response != reference {
169 | NSLog("Int8: \(String(describing: response)) != \(reference)")
170 | }
171 | if responseArray != referenceArray {
172 | NSLog("Int8: \(responseArray) != \(referenceArray)")
173 | }
174 | }
175 |
176 |
177 | if true {
178 | let reference: UInt16 = 123
179 | let referenceArray = [(reference)]
180 | let reference2dArray = [referenceArray]
181 |
182 | let response = responder.charMethod( arg: reference )
183 | let responseArray = responder.charArrayMethod( arg: referenceArray )!
184 | _ = responder.char2dArrayMethod( arg: reference2dArray )
185 |
186 | if response != reference {
187 | NSLog("UInt16: \(String(describing: response)) != \(reference)")
188 | }
189 | if responseArray != referenceArray {
190 | NSLog("UInt16: \(responseArray) != \(referenceArray)")
191 | }
192 | }
193 |
194 |
195 | if true {
196 | let reference: Int16 = 123
197 | let referenceArray = [(reference)]
198 | let reference2dArray = [referenceArray]
199 |
200 | let response = responder.shortMethod( arg: reference )
201 | let responseArray = responder.shortArrayMethod( arg: referenceArray )!
202 | _ = responder.short2dArrayMethod( arg: reference2dArray )
203 |
204 | if response != reference {
205 | NSLog("Int16: \(String(describing: response)) != \(reference)")
206 | }
207 | if responseArray != referenceArray {
208 | NSLog("Int16: \(responseArray) != \(referenceArray)")
209 | }
210 | }
211 |
212 |
213 | if true {
214 | let reference: Int = 123
215 | let referenceArray = [Int32(reference)]
216 | let reference2dArray = [referenceArray]
217 |
218 | let response = responder.intMethod( arg: reference )
219 | let responseArray = responder.intArrayMethod( arg: referenceArray )!
220 | _ = responder.int2dArrayMethod( arg: reference2dArray )
221 |
222 | if response != reference {
223 | NSLog("Int: \(String(describing: response)) != \(reference)")
224 | }
225 | if responseArray != referenceArray {
226 | NSLog("Int: \(responseArray) != \(referenceArray)")
227 | }
228 | }
229 |
230 |
231 | if true {
232 | let reference: Int64 = 123
233 | let referenceArray = [(reference)]
234 | let reference2dArray = [referenceArray]
235 |
236 | let response = responder.longMethod( arg: reference )
237 | let responseArray = responder.longArrayMethod( arg: referenceArray )!
238 | _ = responder.long2dArrayMethod( arg: reference2dArray )
239 |
240 | if response != reference {
241 | NSLog("Int64: \(String(describing: response)) != \(reference)")
242 | }
243 | if responseArray != referenceArray {
244 | NSLog("Int64: \(responseArray) != \(referenceArray)")
245 | }
246 | }
247 |
248 |
249 | if true {
250 | let reference: Float = 123
251 | let referenceArray = [(reference)]
252 | let reference2dArray = [referenceArray]
253 |
254 | let response = responder.floatMethod( arg: reference )
255 | let responseArray = responder.floatArrayMethod( arg: referenceArray )!
256 | _ = responder.float2dArrayMethod( arg: reference2dArray )
257 |
258 | if response != reference {
259 | NSLog("Float: \(String(describing: response)) != \(reference)")
260 | }
261 | if responseArray != referenceArray {
262 | NSLog("Float: \(responseArray) != \(referenceArray)")
263 | }
264 | }
265 |
266 |
267 | if true {
268 | let reference: Double = 123
269 | let referenceArray = [(reference)]
270 | let reference2dArray = [referenceArray]
271 |
272 | let response = responder.doubleMethod( arg: reference )
273 | let responseArray = responder.doubleArrayMethod( arg: referenceArray )!
274 | _ = responder.double2dArrayMethod( arg: reference2dArray )
275 |
276 | if response != reference {
277 | NSLog("Double: \(String(describing: response)) != \(reference)")
278 | }
279 | if responseArray != referenceArray {
280 | NSLog("Double: \(responseArray) != \(referenceArray)")
281 | }
282 | }
283 |
284 |
285 | if true {
286 | let reference: String = "123"
287 | let referenceArray = [(reference)]
288 | let reference2dArray = [referenceArray]
289 |
290 | let response = responder.StringMethod( arg: reference )
291 | let responseArray = responder.StringArrayMethod( arg: referenceArray )!
292 | _ = responder.String2dArrayMethod( arg: reference2dArray )
293 |
294 | if response != reference {
295 | NSLog("String: \(String(describing: response)) != \(reference)")
296 | }
297 | if responseArray != referenceArray {
298 | NSLog("String: \(responseArray) != \(referenceArray)")
299 | }
300 | }
301 |
302 |
303 | if true {
304 | let reference: SwiftHelloTest_TestListener = SwiftTestListener()
305 | let referenceArray = [(reference)]
306 | let reference2dArray = [referenceArray]
307 |
308 | let response = responder.TestListenerMethod( arg: reference )
309 | let responseArray = responder.TestListenerArrayMethod( arg: referenceArray )!
310 | _ = responder.TestListener2dArrayMethod( arg: reference2dArray )
311 | }
312 |
313 | }
314 |
315 | }
316 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTest_SwiftTestListener.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// class com.johnholdsworth.swiftbindings.SwiftHelloTest$SwiftTestListener ///
7 |
8 | open class SwiftHelloTest_SwiftTestListener: SwiftHelloTest_TestResponderAdapter {
9 |
10 | public convenience init?( casting object: java_swift.JavaObject, _ file: StaticString = #file, _ line: Int = #line ) {
11 | self.init( javaObject: nil )
12 | object.withJavaObject {
13 | self.javaObject = $0
14 | }
15 | }
16 |
17 | private static var SwiftHelloTest_SwiftTestListenerJNIClass: jclass?
18 |
19 | /// static int com.johnholdsworth.swiftbindings.SwiftHelloTest$SwiftTestListener.tcount
20 |
21 | // Skipping field: true false false false false false
22 |
23 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener com.johnholdsworth.swiftbindings.SwiftHelloTest$TestResponderAdapter.loopback
24 |
25 | private static var loopback_FieldID: jfieldID?
26 |
27 | override open var loopback: SwiftHelloTest_TestListener! {
28 | get {
29 | let __value = JNIField.GetObjectField( fieldName: "loopback", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTest$TestListener;", fieldCache: &SwiftHelloTest_SwiftTestListener.loopback_FieldID, object: javaObject )
30 | defer { JNI.DeleteLocalRef( __value ) }
31 | return __value != nil ? SwiftHelloTest_TestListenerForward( javaObject: __value ) : nil
32 | }
33 | set(newValue) {
34 | var __locals = [jobject]()
35 | let __value = JNIType.toJava( value: newValue, locals: &__locals )
36 | JNIField.SetObjectField( fieldName: "loopback", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTest$TestListener;", fieldCache: &SwiftHelloTest_SwiftTestListener.loopback_FieldID, object: javaObject, value: __value.l, locals: &__locals )
37 | }
38 | }
39 |
40 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTest$SwiftTestListener()
41 |
42 | private static var new_MethodID_1: jmethodID?
43 |
44 | public convenience init() {
45 | var __locals = [jobject]()
46 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
47 | let __object = JNIMethod.NewObject( className: "com/johnholdsworth/swiftbindings/SwiftHelloTest$SwiftTestListener", classCache: &SwiftHelloTest_SwiftTestListener.SwiftHelloTest_SwiftTestListenerJNIClass, methodSig: "()V", methodCache: &SwiftHelloTest_SwiftTestListener.new_MethodID_1, args: &__args, locals: &__locals )
48 | self.init( javaObject: __object )
49 | JNI.DeleteLocalRef( __object )
50 | }
51 |
52 | /// public void com.johnholdsworth.swiftbindings.SwiftHelloTest$SwiftTestListener.respond(com.johnholdsworth.swiftbindings.SwiftHelloTest$TestListener)
53 |
54 | private static var respond_MethodID_2: jmethodID?
55 |
56 | open func respond( responder: SwiftHelloTest_TestListener? ) {
57 | var __locals = [jobject]()
58 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
59 | __args[0] = JNIType.toJava( value: responder, locals: &__locals )
60 | JNIMethod.CallVoidMethod( object: javaObject, methodName: "respond", methodSig: "(Lcom/johnholdsworth/swiftbindings/SwiftHelloTest$TestListener;)V", methodCache: &SwiftHelloTest_SwiftTestListener.respond_MethodID_2, args: &__args, locals: &__locals )
61 | }
62 |
63 | open func respond( _ _responder: SwiftHelloTest_TestListener? ) {
64 | respond( responder: _responder )
65 | }
66 |
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTypes.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloTypes ///
7 |
8 | public protocol SwiftHelloTypes: JavaProtocol {
9 |
10 | }
11 |
12 |
13 | open class SwiftHelloTypesForward: JNIObjectForward, SwiftHelloTypes {
14 |
15 | private static var SwiftHelloTypesJNIClass: jclass?
16 |
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTypes_ListenerMap.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// class com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap ///
7 |
8 | open class SwiftHelloTypes_ListenerMap: java_swift.HashMap {
9 |
10 | public convenience init?( casting object: java_swift.JavaObject, _ file: StaticString = #file, _ line: Int = #line ) {
11 | self.init( javaObject: nil )
12 | object.withJavaObject {
13 | self.javaObject = $0
14 | }
15 | }
16 |
17 | private static var SwiftHelloTypes_ListenerMapJNIClass: jclass?
18 |
19 | /// static final int java.util.HashMap.DEFAULT_INITIAL_CAPACITY
20 |
21 | // Skipping field: true false false false false false
22 |
23 | /// static final float java.util.HashMap.DEFAULT_LOAD_FACTOR
24 |
25 | // Skipping field: true false false false false false
26 |
27 | /// static final int java.util.HashMap.MAXIMUM_CAPACITY
28 |
29 | // Skipping field: true false false false false false
30 |
31 | /// static final int java.util.HashMap.MIN_TREEIFY_CAPACITY
32 |
33 | // Skipping field: true false false false false false
34 |
35 | /// static final int java.util.HashMap.TREEIFY_THRESHOLD
36 |
37 | // Skipping field: true false false false false false
38 |
39 | /// static final int java.util.HashMap.UNTREEIFY_THRESHOLD
40 |
41 | // Skipping field: true false false false false false
42 |
43 | /// private static final long java.util.HashMap.serialVersionUID
44 |
45 | /// transient java.util.Set java.util.HashMap.entrySet
46 |
47 | // Skipping field: true false false false false false
48 |
49 | /// final float java.util.HashMap.loadFactor
50 |
51 | // Skipping field: true false false false false false
52 |
53 | /// transient int java.util.HashMap.modCount
54 |
55 | // Skipping field: true false false false false false
56 |
57 | /// transient int java.util.HashMap.size
58 |
59 | // Skipping field: true false false false false false
60 |
61 | /// transient java.util.HashMap$Node[] java.util.HashMap.table
62 |
63 | // Skipping field: true false false false false false
64 |
65 | /// int java.util.HashMap.threshold
66 |
67 | // Skipping field: true false false false false false
68 |
69 | /// transient java.util.Set java.util.AbstractMap.keySet
70 |
71 | // Skipping field: true false false false false false
72 |
73 | /// transient java.util.Collection java.util.AbstractMap.values
74 |
75 | // Skipping field: true false false false false false
76 |
77 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap()
78 |
79 | private static var new_MethodID_1: jmethodID?
80 |
81 | public convenience init() {
82 | var __locals = [jobject]()
83 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
84 | let __object = JNIMethod.NewObject( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMap", classCache: &SwiftHelloTypes_ListenerMap.SwiftHelloTypes_ListenerMapJNIClass, methodSig: "()V", methodCache: &SwiftHelloTypes_ListenerMap.new_MethodID_1, args: &__args, locals: &__locals )
85 | self.init( javaObject: __object )
86 | JNI.DeleteLocalRef( __object )
87 | }
88 |
89 | /// public static java.lang.Class com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMap.valueClass()
90 |
91 | private static var valueClass_MethodID_2: jmethodID?
92 |
93 | open class func valueClass() -> java_swift.JavaClass! {
94 | var __locals = [jobject]()
95 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
96 | let __return = JNIMethod.CallStaticObjectMethod( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMap", classCache: &SwiftHelloTypes_ListenerMapJNIClass, methodName: "valueClass", methodSig: "()Ljava/lang/Class;", methodCache: &valueClass_MethodID_2, args: &__args, locals: &__locals )
97 | defer { JNI.DeleteLocalRef( __return ) }
98 | return __return != nil ? java_swift.JavaClass( javaObject: __return ) : nil
99 | }
100 |
101 |
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTypes_ListenerMapList.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// class com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList ///
7 |
8 | open class SwiftHelloTypes_ListenerMapList: java_swift.HashMap {
9 |
10 | public convenience init?( casting object: java_swift.JavaObject, _ file: StaticString = #file, _ line: Int = #line ) {
11 | self.init( javaObject: nil )
12 | object.withJavaObject {
13 | self.javaObject = $0
14 | }
15 | }
16 |
17 | private static var SwiftHelloTypes_ListenerMapListJNIClass: jclass?
18 |
19 | /// static final int java.util.HashMap.DEFAULT_INITIAL_CAPACITY
20 |
21 | // Skipping field: true false false false false false
22 |
23 | /// static final float java.util.HashMap.DEFAULT_LOAD_FACTOR
24 |
25 | // Skipping field: true false false false false false
26 |
27 | /// static final int java.util.HashMap.MAXIMUM_CAPACITY
28 |
29 | // Skipping field: true false false false false false
30 |
31 | /// static final int java.util.HashMap.MIN_TREEIFY_CAPACITY
32 |
33 | // Skipping field: true false false false false false
34 |
35 | /// static final int java.util.HashMap.TREEIFY_THRESHOLD
36 |
37 | // Skipping field: true false false false false false
38 |
39 | /// static final int java.util.HashMap.UNTREEIFY_THRESHOLD
40 |
41 | // Skipping field: true false false false false false
42 |
43 | /// private static final long java.util.HashMap.serialVersionUID
44 |
45 | /// transient java.util.Set java.util.HashMap.entrySet
46 |
47 | // Skipping field: true false false false false false
48 |
49 | /// final float java.util.HashMap.loadFactor
50 |
51 | // Skipping field: true false false false false false
52 |
53 | /// transient int java.util.HashMap.modCount
54 |
55 | // Skipping field: true false false false false false
56 |
57 | /// transient int java.util.HashMap.size
58 |
59 | // Skipping field: true false false false false false
60 |
61 | /// transient java.util.HashMap$Node[] java.util.HashMap.table
62 |
63 | // Skipping field: true false false false false false
64 |
65 | /// int java.util.HashMap.threshold
66 |
67 | // Skipping field: true false false false false false
68 |
69 | /// transient java.util.Set java.util.AbstractMap.keySet
70 |
71 | // Skipping field: true false false false false false
72 |
73 | /// transient java.util.Collection java.util.AbstractMap.values
74 |
75 | // Skipping field: true false false false false false
76 |
77 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList()
78 |
79 | private static var new_MethodID_1: jmethodID?
80 |
81 | public convenience init() {
82 | var __locals = [jobject]()
83 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
84 | let __object = JNIMethod.NewObject( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMapList", classCache: &SwiftHelloTypes_ListenerMapList.SwiftHelloTypes_ListenerMapListJNIClass, methodSig: "()V", methodCache: &SwiftHelloTypes_ListenerMapList.new_MethodID_1, args: &__args, locals: &__locals )
85 | self.init( javaObject: __object )
86 | JNI.DeleteLocalRef( __object )
87 | }
88 |
89 | /// public static java.lang.Class com.johnholdsworth.swiftbindings.SwiftHelloTypes$ListenerMapList.valueClass()
90 |
91 | private static var valueClass_MethodID_2: jmethodID?
92 |
93 | open class func valueClass() -> java_swift.JavaClass! {
94 | var __locals = [jobject]()
95 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
96 | let __return = JNIMethod.CallStaticObjectMethod( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$ListenerMapList", classCache: &SwiftHelloTypes_ListenerMapListJNIClass, methodName: "valueClass", methodSig: "()Ljava/lang/Class;", methodCache: &valueClass_MethodID_2, args: &__args, locals: &__locals )
97 | defer { JNI.DeleteLocalRef( __return ) }
98 | return __return != nil ? java_swift.JavaClass( javaObject: __return ) : nil
99 | }
100 |
101 |
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTypes_Planet.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// class com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet ///
7 |
8 | public enum SwiftHelloTypes_Planet: Int, JNIObjectProtocol, JNIObjectInit {
9 |
10 | case MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE
11 |
12 | static let enumConstants = try! JavaClass.forName("com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet")
13 | .getEnumConstants()!.map { SwiftHelloTypes_PlanetForward( javaObject: $0.javaObject ) }
14 |
15 | public func underlier() -> SwiftHelloTypes_PlanetForward {
16 | return SwiftHelloTypes_Planet.enumConstants[self.rawValue]
17 | }
18 |
19 | public func localJavaObject(_ locals: UnsafeMutablePointer<[jobject]>) -> jobject? {
20 | return underlier().localJavaObject( locals )
21 | }
22 |
23 | public init( javaObject: jobject? ) {
24 | self = SwiftHelloTypes_Planet( rawValue: JavaEnum( javaObject: javaObject ).ordinal() )!
25 | }
26 |
27 | /// public static com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.valueOf(java.lang.String)
28 |
29 | private static var valueOf_MethodID_1: jmethodID?
30 |
31 | public static func valueOf( name: String? ) -> SwiftHelloTypes_Planet! {
32 | return SwiftHelloTypes_PlanetForward.valueOf( name: name )
33 | }
34 | public static func valueOf( _ _name: String? ) -> SwiftHelloTypes_Planet! {
35 | return valueOf( name: _name )
36 | }
37 |
38 | /// public static com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet[] com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.values()
39 |
40 | private static var values_MethodID_2: jmethodID?
41 |
42 | public static func values() -> [SwiftHelloTypes_Planet]! {
43 | return SwiftHelloTypes_PlanetForward.values( )
44 | }
45 |
46 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.mass()
47 |
48 | private static var mass_MethodID_3: jmethodID?
49 |
50 | public func mass() -> Double {
51 | return underlier().mass( )
52 | }
53 |
54 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.radius()
55 |
56 | private static var radius_MethodID_4: jmethodID?
57 |
58 | public func radius() -> Double {
59 | return underlier().radius( )
60 | }
61 |
62 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.surfaceGravity()
63 |
64 | private static var surfaceGravity_MethodID_5: jmethodID?
65 |
66 | public func surfaceGravity() -> Double {
67 | return underlier().surfaceGravity( )
68 | }
69 |
70 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.surfaceWeight(double)
71 |
72 | private static var surfaceWeight_MethodID_6: jmethodID?
73 |
74 | public func surfaceWeight( otherMass: Double ) -> Double {
75 | return underlier().surfaceWeight( otherMass: otherMass )
76 | }
77 | public func surfaceWeight( _ _otherMass: Double ) -> Double {
78 | return surfaceWeight( otherMass: _otherMass )
79 | }
80 |
81 | }
82 |
83 |
84 | open class SwiftHelloTypes_PlanetForward: JNIObjectForward {
85 |
86 | private static var SwiftHelloTypes_PlanetJNIClass: jclass?
87 |
88 | /// private static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet[] com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.$VALUES
89 |
90 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.EARTH
91 |
92 | private static var EARTH_FieldID: jfieldID?
93 |
94 | public static var EARTH: SwiftHelloTypes_Planet! {
95 | get {
96 | let __value = JNIField.GetStaticObjectField( fieldName: "EARTH", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &EARTH_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
97 | defer { JNI.DeleteLocalRef( __value ) }
98 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
99 | }
100 | }
101 |
102 | /// public static final double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.G
103 |
104 | private static var G_FieldID: jfieldID?
105 |
106 | public static var G: Double {
107 | get {
108 | let __value = JNIField.GetStaticDoubleField( fieldName: "G", fieldType: "D", fieldCache: &G_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
109 | return __value
110 | }
111 | }
112 |
113 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.JUPITER
114 |
115 | private static var JUPITER_FieldID: jfieldID?
116 |
117 | public static var JUPITER: SwiftHelloTypes_Planet! {
118 | get {
119 | let __value = JNIField.GetStaticObjectField( fieldName: "JUPITER", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &JUPITER_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
120 | defer { JNI.DeleteLocalRef( __value ) }
121 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
122 | }
123 | }
124 |
125 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.MARS
126 |
127 | private static var MARS_FieldID: jfieldID?
128 |
129 | public static var MARS: SwiftHelloTypes_Planet! {
130 | get {
131 | let __value = JNIField.GetStaticObjectField( fieldName: "MARS", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &MARS_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
132 | defer { JNI.DeleteLocalRef( __value ) }
133 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
134 | }
135 | }
136 |
137 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.MERCURY
138 |
139 | private static var MERCURY_FieldID: jfieldID?
140 |
141 | public static var MERCURY: SwiftHelloTypes_Planet! {
142 | get {
143 | let __value = JNIField.GetStaticObjectField( fieldName: "MERCURY", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &MERCURY_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
144 | defer { JNI.DeleteLocalRef( __value ) }
145 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
146 | }
147 | }
148 |
149 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.NEPTUNE
150 |
151 | private static var NEPTUNE_FieldID: jfieldID?
152 |
153 | public static var NEPTUNE: SwiftHelloTypes_Planet! {
154 | get {
155 | let __value = JNIField.GetStaticObjectField( fieldName: "NEPTUNE", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &NEPTUNE_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
156 | defer { JNI.DeleteLocalRef( __value ) }
157 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
158 | }
159 | }
160 |
161 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.SATURN
162 |
163 | private static var SATURN_FieldID: jfieldID?
164 |
165 | public static var SATURN: SwiftHelloTypes_Planet! {
166 | get {
167 | let __value = JNIField.GetStaticObjectField( fieldName: "SATURN", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &SATURN_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
168 | defer { JNI.DeleteLocalRef( __value ) }
169 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
170 | }
171 | }
172 |
173 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.URANUS
174 |
175 | private static var URANUS_FieldID: jfieldID?
176 |
177 | public static var URANUS: SwiftHelloTypes_Planet! {
178 | get {
179 | let __value = JNIField.GetStaticObjectField( fieldName: "URANUS", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &URANUS_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
180 | defer { JNI.DeleteLocalRef( __value ) }
181 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
182 | }
183 | }
184 |
185 | /// public static final com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.VENUS
186 |
187 | private static var VENUS_FieldID: jfieldID?
188 |
189 | public static var VENUS: SwiftHelloTypes_Planet! {
190 | get {
191 | let __value = JNIField.GetStaticObjectField( fieldName: "VENUS", fieldType: "Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", fieldCache: &VENUS_FieldID, className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass )
192 | defer { JNI.DeleteLocalRef( __value ) }
193 | return __value != nil ? SwiftHelloTypes_Planet( javaObject: __value ) : nil
194 | }
195 | }
196 |
197 | /// private final double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.mass
198 |
199 | /// private final double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.radius
200 |
201 | /// public static com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.valueOf(java.lang.String)
202 |
203 | private static var valueOf_MethodID_7: jmethodID?
204 |
205 | open class func valueOf( name: String? ) -> SwiftHelloTypes_Planet! {
206 | var __locals = [jobject]()
207 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
208 | __args[0] = JNIType.toJava( value: name, locals: &__locals )
209 | let __return = JNIMethod.CallStaticObjectMethod( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass, methodName: "valueOf", methodSig: "(Ljava/lang/String;)Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", methodCache: &valueOf_MethodID_7, args: &__args, locals: &__locals )
210 | defer { JNI.DeleteLocalRef( __return ) }
211 | return __return != nil ? SwiftHelloTypes_Planet( javaObject: __return ) : nil
212 | }
213 |
214 | open class func valueOf( _ _name: String? ) -> SwiftHelloTypes_Planet! {
215 | return valueOf( name: _name )
216 | }
217 |
218 | /// public static java.lang.Enum java.lang.Enum.valueOf(java.lang.Class,java.lang.String)
219 |
220 | private static var valueOf_MethodID_8: jmethodID?
221 |
222 | open class func valueOf( enumType: java_swift.JavaClass?, name: String? ) -> java_swift.JavaEnum! {
223 | var __locals = [jobject]()
224 | var __args = [jvalue]( repeating: jvalue(), count: 2 )
225 | __args[0] = JNIType.toJava( value: enumType, locals: &__locals )
226 | __args[1] = JNIType.toJava( value: name, locals: &__locals )
227 | let __return = JNIMethod.CallStaticObjectMethod( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass, methodName: "valueOf", methodSig: "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;", methodCache: &valueOf_MethodID_8, args: &__args, locals: &__locals )
228 | defer { JNI.DeleteLocalRef( __return ) }
229 | return __return != nil ? java_swift.JavaEnum( javaObject: __return ) : nil
230 | }
231 |
232 | open class func valueOf( _ _enumType: java_swift.JavaClass?, _ _name: String? ) -> java_swift.JavaEnum! {
233 | return valueOf( enumType: _enumType, name: _name )
234 | }
235 |
236 | /// public static com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet[] com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.values()
237 |
238 | private static var values_MethodID_9: jmethodID?
239 |
240 | open class func values() -> [SwiftHelloTypes_Planet]! {
241 | var __locals = [jobject]()
242 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
243 | let __return = JNIMethod.CallStaticObjectMethod( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet", classCache: &SwiftHelloTypes_PlanetJNIClass, methodName: "values", methodSig: "()[Lcom/johnholdsworth/swiftbindings/SwiftHelloTypes$Planet;", methodCache: &values_MethodID_9, args: &__args, locals: &__locals )
244 | return JNIType.toSwift( type: [SwiftHelloTypes_Planet].self, from: __return )
245 | }
246 |
247 |
248 | /// public final int java.lang.Enum.compareTo(java.lang.Enum)
249 |
250 | // Skipping method: false true false false false
251 |
252 | /// public int java.lang.Enum.compareTo(java.lang.Object)
253 |
254 | // Skipping method: false true false false false
255 |
256 | /// public final boolean java.lang.Enum.equals(java.lang.Object)
257 |
258 | // Skipping method: false true false false false
259 |
260 | /// public final native java.lang.Class java.lang.Object.getClass()
261 |
262 | // Skipping method: false true false false false
263 |
264 | /// public final java.lang.Class java.lang.Enum.getDeclaringClass()
265 |
266 | // Skipping method: false true false false false
267 |
268 | /// public final int java.lang.Enum.hashCode()
269 |
270 | // Skipping method: false true false false false
271 |
272 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.mass()
273 |
274 | private static var mass_MethodID_10: jmethodID?
275 |
276 | open func mass() -> Double {
277 | var __locals = [jobject]()
278 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
279 | let __return = JNIMethod.CallDoubleMethod( object: javaObject, methodName: "mass", methodSig: "()D", methodCache: &SwiftHelloTypes_PlanetForward.mass_MethodID_10, args: &__args, locals: &__locals )
280 | return __return
281 | }
282 |
283 |
284 | /// public final java.lang.String java.lang.Enum.name()
285 |
286 | // Skipping method: false true false false false
287 |
288 | /// public final native void java.lang.Object.notify()
289 |
290 | // Skipping method: false true false false false
291 |
292 | /// public final native void java.lang.Object.notifyAll()
293 |
294 | // Skipping method: false true false false false
295 |
296 | /// public final int java.lang.Enum.ordinal()
297 |
298 | // Skipping method: false true false false false
299 |
300 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.radius()
301 |
302 | private static var radius_MethodID_11: jmethodID?
303 |
304 | open func radius() -> Double {
305 | var __locals = [jobject]()
306 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
307 | let __return = JNIMethod.CallDoubleMethod( object: javaObject, methodName: "radius", methodSig: "()D", methodCache: &SwiftHelloTypes_PlanetForward.radius_MethodID_11, args: &__args, locals: &__locals )
308 | return __return
309 | }
310 |
311 |
312 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.surfaceGravity()
313 |
314 | private static var surfaceGravity_MethodID_12: jmethodID?
315 |
316 | open func surfaceGravity() -> Double {
317 | var __locals = [jobject]()
318 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
319 | let __return = JNIMethod.CallDoubleMethod( object: javaObject, methodName: "surfaceGravity", methodSig: "()D", methodCache: &SwiftHelloTypes_PlanetForward.surfaceGravity_MethodID_12, args: &__args, locals: &__locals )
320 | return __return
321 | }
322 |
323 |
324 | /// public double com.johnholdsworth.swiftbindings.SwiftHelloTypes$Planet.surfaceWeight(double)
325 |
326 | private static var surfaceWeight_MethodID_13: jmethodID?
327 |
328 | open func surfaceWeight( otherMass: Double ) -> Double {
329 | var __locals = [jobject]()
330 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
331 | __args[0] = jvalue( d: otherMass )
332 | let __return = JNIMethod.CallDoubleMethod( object: javaObject, methodName: "surfaceWeight", methodSig: "(D)D", methodCache: &SwiftHelloTypes_PlanetForward.surfaceWeight_MethodID_13, args: &__args, locals: &__locals )
333 | return __return
334 | }
335 |
336 | open func surfaceWeight( _ _otherMass: Double ) -> Double {
337 | return surfaceWeight( otherMass: _otherMass )
338 | }
339 |
340 | /// public java.lang.String java.lang.Enum.toString()
341 |
342 | // Skipping method: false true false false false
343 |
344 | /// public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
345 |
346 | // Skipping method: false true false false false
347 |
348 | /// public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
349 |
350 | // Skipping method: false true false false false
351 |
352 | /// public final void java.lang.Object.wait() throws java.lang.InterruptedException
353 |
354 | // Skipping method: false true false false false
355 |
356 | }
357 |
358 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTypes_StringMap.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// class com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap ///
7 |
8 | open class SwiftHelloTypes_StringMap: java_swift.HashMap {
9 |
10 | public convenience init?( casting object: java_swift.JavaObject, _ file: StaticString = #file, _ line: Int = #line ) {
11 | self.init( javaObject: nil )
12 | object.withJavaObject {
13 | self.javaObject = $0
14 | }
15 | }
16 |
17 | private static var SwiftHelloTypes_StringMapJNIClass: jclass?
18 |
19 | /// static final int java.util.HashMap.DEFAULT_INITIAL_CAPACITY
20 |
21 | // Skipping field: true false false false false false
22 |
23 | /// static final float java.util.HashMap.DEFAULT_LOAD_FACTOR
24 |
25 | // Skipping field: true false false false false false
26 |
27 | /// static final int java.util.HashMap.MAXIMUM_CAPACITY
28 |
29 | // Skipping field: true false false false false false
30 |
31 | /// static final int java.util.HashMap.MIN_TREEIFY_CAPACITY
32 |
33 | // Skipping field: true false false false false false
34 |
35 | /// static final int java.util.HashMap.TREEIFY_THRESHOLD
36 |
37 | // Skipping field: true false false false false false
38 |
39 | /// static final int java.util.HashMap.UNTREEIFY_THRESHOLD
40 |
41 | // Skipping field: true false false false false false
42 |
43 | /// private static final long java.util.HashMap.serialVersionUID
44 |
45 | /// transient java.util.Set java.util.HashMap.entrySet
46 |
47 | // Skipping field: true false false false false false
48 |
49 | /// final float java.util.HashMap.loadFactor
50 |
51 | // Skipping field: true false false false false false
52 |
53 | /// transient int java.util.HashMap.modCount
54 |
55 | // Skipping field: true false false false false false
56 |
57 | /// transient int java.util.HashMap.size
58 |
59 | // Skipping field: true false false false false false
60 |
61 | /// transient java.util.HashMap$Node[] java.util.HashMap.table
62 |
63 | // Skipping field: true false false false false false
64 |
65 | /// int java.util.HashMap.threshold
66 |
67 | // Skipping field: true false false false false false
68 |
69 | /// transient java.util.Set java.util.AbstractMap.keySet
70 |
71 | // Skipping field: true false false false false false
72 |
73 | /// transient java.util.Collection java.util.AbstractMap.values
74 |
75 | // Skipping field: true false false false false false
76 |
77 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap()
78 |
79 | private static var new_MethodID_1: jmethodID?
80 |
81 | public convenience init() {
82 | var __locals = [jobject]()
83 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
84 | let __object = JNIMethod.NewObject( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap", classCache: &SwiftHelloTypes_StringMap.SwiftHelloTypes_StringMapJNIClass, methodSig: "()V", methodCache: &SwiftHelloTypes_StringMap.new_MethodID_1, args: &__args, locals: &__locals )
85 | self.init( javaObject: __object )
86 | JNI.DeleteLocalRef( __object )
87 | }
88 |
89 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap(java.util.Map)
90 |
91 | private static var new_MethodID_2: jmethodID?
92 |
93 | public convenience init( map: java_swift.JavaMap? ) {
94 | var __locals = [jobject]()
95 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
96 | __args[0] = JNIType.toJava( value: map, mapClass: "java/util/Map", locals: &__locals )
97 | let __object = JNIMethod.NewObject( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap", classCache: &SwiftHelloTypes_StringMap.SwiftHelloTypes_StringMapJNIClass, methodSig: "(Ljava/util/Map;)V", methodCache: &SwiftHelloTypes_StringMap.new_MethodID_2, args: &__args, locals: &__locals )
98 | self.init( javaObject: __object )
99 | JNI.DeleteLocalRef( __object )
100 | }
101 |
102 | public convenience init( _ _map: java_swift.JavaMap? ) {
103 | self.init( map: _map )
104 | }
105 |
106 | /// public static java.lang.Class com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMap.valueClass()
107 |
108 | private static var valueClass_MethodID_3: jmethodID?
109 |
110 | open class func valueClass() -> java_swift.JavaClass! {
111 | var __locals = [jobject]()
112 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
113 | let __return = JNIMethod.CallStaticObjectMethod( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMap", classCache: &SwiftHelloTypes_StringMapJNIClass, methodName: "valueClass", methodSig: "()Ljava/lang/Class;", methodCache: &valueClass_MethodID_3, args: &__args, locals: &__locals )
114 | defer { JNI.DeleteLocalRef( __return ) }
115 | return __return != nil ? java_swift.JavaClass( javaObject: __return ) : nil
116 | }
117 |
118 |
119 | }
120 |
121 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTypes_StringMapList.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// class com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList ///
7 |
8 | open class SwiftHelloTypes_StringMapList: java_swift.HashMap {
9 |
10 | public convenience init?( casting object: java_swift.JavaObject, _ file: StaticString = #file, _ line: Int = #line ) {
11 | self.init( javaObject: nil )
12 | object.withJavaObject {
13 | self.javaObject = $0
14 | }
15 | }
16 |
17 | private static var SwiftHelloTypes_StringMapListJNIClass: jclass?
18 |
19 | /// static final int java.util.HashMap.DEFAULT_INITIAL_CAPACITY
20 |
21 | // Skipping field: true false false false false false
22 |
23 | /// static final float java.util.HashMap.DEFAULT_LOAD_FACTOR
24 |
25 | // Skipping field: true false false false false false
26 |
27 | /// static final int java.util.HashMap.MAXIMUM_CAPACITY
28 |
29 | // Skipping field: true false false false false false
30 |
31 | /// static final int java.util.HashMap.MIN_TREEIFY_CAPACITY
32 |
33 | // Skipping field: true false false false false false
34 |
35 | /// static final int java.util.HashMap.TREEIFY_THRESHOLD
36 |
37 | // Skipping field: true false false false false false
38 |
39 | /// static final int java.util.HashMap.UNTREEIFY_THRESHOLD
40 |
41 | // Skipping field: true false false false false false
42 |
43 | /// private static final long java.util.HashMap.serialVersionUID
44 |
45 | /// transient java.util.Set java.util.HashMap.entrySet
46 |
47 | // Skipping field: true false false false false false
48 |
49 | /// final float java.util.HashMap.loadFactor
50 |
51 | // Skipping field: true false false false false false
52 |
53 | /// transient int java.util.HashMap.modCount
54 |
55 | // Skipping field: true false false false false false
56 |
57 | /// transient int java.util.HashMap.size
58 |
59 | // Skipping field: true false false false false false
60 |
61 | /// transient java.util.HashMap$Node[] java.util.HashMap.table
62 |
63 | // Skipping field: true false false false false false
64 |
65 | /// int java.util.HashMap.threshold
66 |
67 | // Skipping field: true false false false false false
68 |
69 | /// transient java.util.Set java.util.AbstractMap.keySet
70 |
71 | // Skipping field: true false false false false false
72 |
73 | /// transient java.util.Collection java.util.AbstractMap.values
74 |
75 | // Skipping field: true false false false false false
76 |
77 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList()
78 |
79 | private static var new_MethodID_1: jmethodID?
80 |
81 | public convenience init() {
82 | var __locals = [jobject]()
83 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
84 | let __object = JNIMethod.NewObject( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList", classCache: &SwiftHelloTypes_StringMapList.SwiftHelloTypes_StringMapListJNIClass, methodSig: "()V", methodCache: &SwiftHelloTypes_StringMapList.new_MethodID_1, args: &__args, locals: &__locals )
85 | self.init( javaObject: __object )
86 | JNI.DeleteLocalRef( __object )
87 | }
88 |
89 | /// public com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList(java.util.Map)
90 |
91 | private static var new_MethodID_2: jmethodID?
92 |
93 | public convenience init( map: java_swift.JavaMap? ) {
94 | var __locals = [jobject]()
95 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
96 | __args[0] = JNIType.toJava( value: map, mapClass: "java/util/Map", locals: &__locals )
97 | let __object = JNIMethod.NewObject( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList", classCache: &SwiftHelloTypes_StringMapList.SwiftHelloTypes_StringMapListJNIClass, methodSig: "(Ljava/util/Map;)V", methodCache: &SwiftHelloTypes_StringMapList.new_MethodID_2, args: &__args, locals: &__locals )
98 | self.init( javaObject: __object )
99 | JNI.DeleteLocalRef( __object )
100 | }
101 |
102 | public convenience init( _ _map: java_swift.JavaMap? ) {
103 | self.init( map: _map )
104 | }
105 |
106 | /// public static java.lang.Class com.johnholdsworth.swiftbindings.SwiftHelloTypes$StringMapList.valueClass()
107 |
108 | private static var valueClass_MethodID_3: jmethodID?
109 |
110 | open class func valueClass() -> java_swift.JavaClass! {
111 | var __locals = [jobject]()
112 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
113 | let __return = JNIMethod.CallStaticObjectMethod( className: "com/johnholdsworth/swiftbindings/SwiftHelloTypes$StringMapList", classCache: &SwiftHelloTypes_StringMapListJNIClass, methodName: "valueClass", methodSig: "()Ljava/lang/Class;", methodCache: &valueClass_MethodID_3, args: &__args, locals: &__locals )
114 | defer { JNI.DeleteLocalRef( __return ) }
115 | return __return != nil ? java_swift.JavaClass( javaObject: __return ) : nil
116 | }
117 |
118 |
119 | }
120 |
121 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/SwiftHelloTypes_TextListener.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 |
4 | /// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
5 |
6 | /// interface com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener ///
7 |
8 | public protocol SwiftHelloTypes_TextListener: JavaProtocol {
9 |
10 | /// public abstract java.lang.String com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener.getText()
11 |
12 | func getText() -> String!
13 |
14 | }
15 |
16 |
17 | open class SwiftHelloTypes_TextListenerForward: JNIObjectForward, SwiftHelloTypes_TextListener {
18 |
19 | private static var SwiftHelloTypes_TextListenerJNIClass: jclass?
20 |
21 | /// public abstract java.lang.String com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener.getText()
22 |
23 | private static var getText_MethodID_2: jmethodID?
24 |
25 | open func getText() -> String! {
26 | var __locals = [jobject]()
27 | var __args = [jvalue]( repeating: jvalue(), count: 1 )
28 | let __return = JNIMethod.CallObjectMethod( object: javaObject, methodName: "getText", methodSig: "()Ljava/lang/String;", methodCache: &SwiftHelloTypes_TextListenerForward.getText_MethodID_2, args: &__args, locals: &__locals )
29 | defer { JNI.DeleteLocalRef( __return ) }
30 | return __return != nil ? String( javaObject: __return ) : nil
31 | }
32 |
33 |
34 | }
35 |
36 | private typealias SwiftHelloTypes_TextListener_getText_0_type = @convention(c) ( _: UnsafeMutablePointer, _: jobject?, _: jlong ) -> jobject?
37 |
38 | private func SwiftHelloTypes_TextListener_getText_0( _ __env: UnsafeMutablePointer, _ __this: jobject?, _ __swiftObject: jlong ) -> jobject? {
39 | let __return = SwiftHelloTypes_TextListenerLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).getText( )
40 | var __locals = [jobject]()
41 | return JNI.check( JNIType.toJava( value: __return, locals: &__locals ).l, &__locals, removeLast: true )
42 | }
43 |
44 | fileprivate class SwiftHelloTypes_TextListenerLocal_: JNILocalProxy {
45 |
46 | fileprivate static let _proxyClass: jclass = {
47 | var natives = [JNINativeMethod]()
48 |
49 | let SwiftHelloTypes_TextListener_getText_0_thunk: SwiftHelloTypes_TextListener_getText_0_type = SwiftHelloTypes_TextListener_getText_0
50 | natives.append( JNINativeMethod( name: strdup("__getText"), signature: strdup("(J)Ljava/lang/String;"), fnPtr: unsafeBitCast( SwiftHelloTypes_TextListener_getText_0_thunk, to: UnsafeMutableRawPointer.self ) ) )
51 |
52 | natives.append( JNINativeMethod( name: strdup("__finalize"), signature: strdup("(J)V"), fnPtr: unsafeBitCast( JNIReleasableProxy__finalize_thunk, to: UnsafeMutableRawPointer.self ) ) )
53 |
54 | let clazz = JNI.FindClass( proxyClassName() )
55 | withUnsafePointer(to: &natives[0]) {
56 | nativesPtr in
57 | if JNI.api.RegisterNatives( JNI.env, clazz, nativesPtr, jint(natives.count) ) != jint(JNI_OK) {
58 | JNI.report( "Unable to register java natives" )
59 | }
60 | }
61 |
62 | defer { JNI.DeleteLocalRef( clazz ) }
63 | return JNI.api.NewGlobalRef( JNI.env, clazz )!
64 | }()
65 |
66 | override open class func proxyClassName() -> String { return "org/swiftjava/com_johnholdsworth/SwiftHelloTypes_TextListenerProxy" }
67 | override open class func proxyClass() -> jclass? { return _proxyClass }
68 |
69 | }
70 |
71 | extension SwiftHelloTypes_TextListener {
72 |
73 | public func localJavaObject( _ locals: UnsafeMutablePointer<[jobject]> ) -> jobject? {
74 | return SwiftHelloTypes_TextListenerLocal_( owned: self, proto: self ).localJavaObject( locals )
75 | }
76 |
77 | }
78 |
79 | open class SwiftHelloTypes_TextListenerBase: SwiftHelloTypes_TextListener {
80 |
81 | public init() {}
82 |
83 | /// public abstract java.lang.String com.johnholdsworth.swiftbindings.SwiftHelloTypes$TextListener.getText()
84 |
85 | open func getText() -> String! /**/ {
86 | return nil
87 | }
88 |
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/app/src/main/swift/Sources/swifthello.swift:
--------------------------------------------------------------------------------
1 |
2 | import java_swift
3 | import Foundation
4 |
5 | import Alamofire
6 | import sqlite3
7 | import XCTest
8 |
9 | // responder variable moved to Statics.swift
10 | // so it isn't reset when class is injected.
11 | //// link back to Java side of Application
12 | //var responder: SwiftHelloBinding_ResponderForward!
13 |
14 | // one-off call to bind the Java and Swift sections of app
15 | @_silgen_name("Java_net_zhuoweizhang_swifthello_SwiftHello_bind")
16 | public func bind_samples( __env: UnsafeMutablePointer, __this: jobject?, __self: jobject? )-> jobject? {
17 |
18 | // This Swift instance forwards to Java through JNI
19 | responder = SwiftHelloBinding_ResponderForward( javaObject: __self )
20 |
21 | // This Swift instance receives native calls from Java
22 | var locals = [jobject]()
23 | return SwiftListenerImpl().localJavaObject( &locals )
24 | }
25 |
26 | // kotlin's call to bind the Java and Swift sections of app
27 | @_silgen_name("Java_com_example_user_myapplication_MainActivity_bind_00024app_1debug")
28 | public func bind_kotlin( __env: UnsafeMutablePointer, __this: jobject?, __self: jobject? )-> jobject? {
29 |
30 | // This Swift instance forwards to Java through JNI
31 | responder = SwiftHelloBinding_ResponderForward( javaObject: __self )
32 |
33 | // This Swift instance receives native calls from Java
34 | var locals = [jobject]()
35 | return SwiftListenerImpl().localJavaObject( &locals )
36 | }
37 |
38 | struct MyText: SwiftHelloTypes_TextListener {
39 | let text: String?
40 | init(_ text: String) {
41 | self.text = text
42 | }
43 | func getText() -> String! {
44 | return text
45 | }
46 | }
47 |
48 | class SwiftListenerImpl: SwiftHelloBinding_Listener {
49 |
50 | var handle: OpaquePointer? = nil
51 |
52 | func setCacheDir( cacheDir: String? ) {
53 | setenv( "TMPDIR", cacheDir!, 1 )
54 |
55 | // Required for SSL to work
56 | setenv( "URLSessionCertificateAuthorityInfoFile", cacheDir! + "/cacert.pem", 1 )
57 |
58 | // MyText Proxy object must be loaded
59 | // on main thread before it is used.
60 | MyText("").withJavaObject { _ in }
61 | ClosureRunnable({}).withJavaObject { _ in }
62 |
63 | DispatchQueue.main.sync {
64 | // Quick SQLite test
65 | NSLog("Open db: \(sqlite3_open(cacheDir!+"sqltest.db", &handle) == SQLITE_OK)")
66 |
67 | NSLog("Create table: \(sqlite3_exec(handle, """
68 | CREATE TABLE Test (
69 | Text TEXT
70 | )
71 | """, nil, nil, nil) == SQLITE_OK)")
72 |
73 | var stmt: OpaquePointer?
74 |
75 | let f = DateFormatter()
76 | f.dateStyle = .long
77 | f.timeStyle = .long
78 | f.timeZone = TimeZone.current
79 | f.string(from: Date()).withCString {
80 | NSLog("Insert: \(sqlite3_prepare_v2(handle, """
81 | INSERT INTO Test (Text)
82 | VALUES (?);
83 | """, -1, &stmt, nil) == SQLITE_OK)")
84 | sqlite3_bind_text(stmt, 1, $0, -1, nil)
85 | sqlite3_step(stmt)
86 | sqlite3_finalize(stmt)
87 | }
88 |
89 | NSLog("Select: \(sqlite3_prepare_v2( handle, """
90 | SELECT Text
91 | FROM Test
92 | """, -1, &stmt, nil) == SQLITE_OK)")
93 | while sqlite3_step(stmt) == SQLITE_ROW {
94 | if let text = sqlite3_column_text(stmt, 0) {
95 | NSLog("Run: \(String(cString: text))")
96 | }
97 | else {
98 | NSLog("Null row")
99 | }
100 | }
101 | sqlite3_finalize(stmt)
102 | }
103 |
104 | // XCTest test
105 | let uuidA = NSUUID()
106 | let uuidB = NSKeyedUnarchiver.unarchiveObject(with: NSKeyedArchiver.archivedData(withRootObject: uuidA)) as! NSUUID
107 | XCTAssertEqual(uuidA, uuidB, "NSKeyedUnarchiver check")
108 | }
109 |
110 | func testResponder( loopback: Int ) -> SwiftHelloTest_TestListener! {
111 | let test = SwiftTestListener()
112 | if loopback > 0 {
113 | test.setLoopback( loopback: responder.testResponder( loopback: loopback - 1 ) )
114 | }
115 | return test
116 | }
117 |
118 | // incoming from Java activity
119 | func processNumber( number: Double ) {
120 | // outgoing back to Java
121 | responder.processedNumber( number: number+42.0 )
122 | }
123 |
124 | // incoming from Java activity
125 | func processText( text: String? ) {
126 | basicTests(reps: 10)
127 | processText( text!, initial: true )
128 | }
129 |
130 | func basicTests(reps: Int) {
131 | for _ in 0.. Double {
194 | throw Exception("Swift test exception")
195 | }
196 |
197 | static var thread = 0
198 | var i = 0
199 | let session = URLSession( configuration: .default )
200 | let url = URL( string: "https://en.wikipedia.org/wiki/Main_Page" )!
201 | let regexp = try! NSRegularExpression( pattern:"(\\w+)", options:[] )
202 |
203 | func processText( _ text: String, initial: Bool ) {
204 | var out = [String]()
205 | for _ in 0..<10 {
206 | out.append( "Hello "+text+"!" )
207 | }
208 |
209 | do {
210 | var enc: UInt = 0
211 | let input = try NSString( contentsOf: url, usedEncoding: &enc )
212 | for match in self.regexp.matches( in: String( describing: input ), options: [],
213 | range: NSMakeRange( 0, input.length ) ) {
214 | out.append( "\(input.substring( with: match.range ))" )
215 | }
216 |
217 | NSLog( "Display" )
218 | // outgoing back to Java
219 | responder.processedTextListener2dArray( text: [[MyText(out.joined(separator:", "))]] )
220 |
221 | var memory = rusage()
222 | getrusage( RUSAGE_SELF, &memory )
223 | NSLog( "Done \(memory.ru_maxrss) \(text)" )
224 | }
225 | catch (let e) {
226 | responder.processedText("\(e)")
227 | }
228 |
229 | if initial {
230 | SwiftListenerImpl.thread += 1
231 | let background = SwiftListenerImpl.thread
232 | let other = OtherClass()
233 | DispatchQueue.main.async {
234 | for t in 0..<1 {
235 | DispatchQueue.global(qos: .background).async {
236 | for i in 1..<10 {
237 | NSLog( "Sleeping" )
238 | Thread.sleep(forTimeInterval: 3)
239 |
240 | // outgoing back to Java
241 | _ = responder.debug( msg: "Process \(background)/\(i)" )
242 | self.processText( "World #\(t).\(i)", initial: false )
243 |
244 | self.iteration(other: other)
245 | }
246 | }
247 | }
248 | }
249 | }
250 | }
251 |
252 | func iteration(other: OtherClass) {
253 | NSLog("Iteration")
254 |
255 | other.log()
256 |
257 | Thread.sleep(forTimeInterval: 2)
258 | let url = URL(string: "http://jsonplaceholder.typicode.com/posts")!
259 | session.dataTask( with: URLRequest( url: url ) ) {
260 | (data, response, error) in
261 | if let data = data {
262 | do {
263 | let json = try JSONSerialization.jsonObject(with: data)
264 | let text = try JSONSerialization.data(withJSONObject: json)
265 | responder.processedText( String( data: text, encoding: .utf8 ) )
266 | }
267 | catch let e {
268 | responder.processedText( "\(e)" )
269 | }
270 | }
271 | else {
272 | responder.processedText( "\(String(describing: error))" )
273 | }
274 | }.resume()
275 |
276 | Thread.sleep(forTimeInterval: 2)
277 | Alamofire.request("https://httpbin.org/get").responseJSON { response in
278 | NSLog("Request: \(String(describing: response.request))") // original url request
279 | NSLog("Response: \(String(describing: response.response))") // http url response
280 | NSLog("Result: \(response.result)") // response serialization result
281 |
282 | if let json = response.result.value {
283 | NSLog("JSON: \(json)") // serialized json response
284 | // let archive = NSKeyedArchiver.archivedData(withRootObject: json)
285 | // let object = NSKeyedUnarchiver.unarchiveObject(with: archive)
286 | }
287 |
288 | if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
289 | NSLog("Data: \(utf8Text)") // original server data as UTF8 string
290 | }
291 | }
292 | }
293 | }
294 |
295 | class OtherClass {
296 | func log() {
297 | NSLog("Injectable message #1")
298 | }
299 | }
300 |
301 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/user/myapplication/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.user.myapplication;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.1.3-2'
5 | repositories {
6 | jcenter()
7 | mavenLocal()
8 | mavenCentral()
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:2.3.0'
12 | classpath 'net.zhuoweizhang:swiftandroid:1.0.0'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 |
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 |
22 | repositories {
23 | jcenter()
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiftJava/swift-android-kotlin/5514cf5c8da9609793470b384d991ffeb7a11281/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jul 29 03:02:30 BST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/hybrid.t2d:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/swift-android-kotlin.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------