Extending a class and wrapping methods
You are browsing legacy Javonet 1.5 (Java<>.NET bridge for Windows) documentation. Use the left side menu or click here to switch to latest Javonet 2.0 documentation. Javonet 2.0 allows you to use any module from
JVM, CLR, Netcore, Python, Ruby, Perl, NodeJS on Windows, Linux and MacOs
from any application created in Java, Clojure, Groovy, Kotlin, C#, F#, J#, VB.NET, Python, Perl, Ruby, JavaScript, TypeScript, C++ and GoLang
You can extend any class from any runtime by extending the C# class with the NObject/JObject type and then call the constructor base constructor by passing the name of the called type and arguments for its constructor as an argument.
Assuming we have a custom any runtime with the following class inside:
To extend this class and wrap method from this class create the following class:
And use it like any other C# class
Was this article helpful?