Added additional cast method

This commit is contained in:
Robinson 2023-09-25 13:58:32 +02:00
parent 1b6880bf7d
commit b2217f66ee
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 8 additions and 0 deletions

View File

@ -313,6 +313,14 @@ class RmiSupportConnection<CONNECTION: Connection> : RmiObjectCache {
}
/**
* Casts this remote object (specified by it's RMI ID) to the "RemoteObject" type, so that those methods can more easily be called
*/
inline fun <reified T> cast(rmiId: Int): RemoteObject<T> {
val obj = get<T>(rmiId)
@Suppress("UNCHECKED_CAST")
return obj as RemoteObject<T>
}
/**