@@ -13,11 +13,19 @@ import java.net.URL
13
13
import java.nio.charset.StandardCharsets
14
14
import java.util.jar.Manifest
15
15
import java.util.zip.ZipException
16
+ import kotlin.reflect.KClass
16
17
17
18
interface PlugRegistry {
18
- fun <T : Any > registerSocket (socketClass : Class <T >, socketOwner : SocketOwner <T >)
19
+ fun <T : Any > registerSocket (socketClass : KClass <T >, socketOwner : SocketOwner <T >)
19
20
20
- fun <T : Any > instantiatePlug (socketClass : Class <T >, plugDescriptor : PlugDescriptor ): T
21
+ fun <T : Any > instantiatePlug (socketClass : KClass <T >, plugDescriptor : PlugDescriptor ): T
22
+
23
+ fun <T : Any > registerSocket (socketClass : Class <T >, socketOwner : SocketOwner <T >) {
24
+ registerSocket(socketClass.kotlin, socketOwner)
25
+ }
26
+
27
+ fun <T : Any > instantiatePlug (socketClass : Class <T >, plugDescriptor : PlugDescriptor ): T =
28
+ instantiatePlug(socketClass.kotlin, plugDescriptor)
21
29
22
30
companion object {
23
31
private val instance: Lazy <PlugRegistry > = lazy { Eager () }
@@ -116,16 +124,16 @@ interface PlugRegistry {
116
124
return PlugDescriptor .fromJson(serviceFileContent)
117
125
}
118
126
119
- override fun <T : Any > registerSocket (socketClass : Class <T >, socketOwner : SocketOwner <T >) {
127
+ override fun <T : Any > registerSocket (socketClass : KClass <T >, socketOwner : SocketOwner <T >) {
120
128
synchronized(this ) {
121
- val prevOwner = owners.put(socketClass.name , socketOwner)
129
+ val prevOwner = owners.put(socketClass.qualifiedName !! , socketOwner)
122
130
assert (prevOwner == null ) { " Multiple owners registered for $socketClass " }
123
- data.descriptorMap[socketClass.name ]?.forEach(socketOwner::doRegister)
131
+ data.descriptorMap[socketClass.qualifiedName ]?.forEach(socketOwner::doRegister)
124
132
}
125
133
}
126
134
127
135
override fun <T : Any > instantiatePlug (
128
- socketClass : Class <T >,
136
+ socketClass : KClass <T >,
129
137
plugDescriptor : PlugDescriptor
130
138
): T {
131
139
val value =
0 commit comments