Coding With the .NET v3 Proxy Types Tutorial
The purpose of this tutorial is to introduce you to the basics of writing .NET applications that use .NET v3 Proxy Types.
The v3
moniker stems from Codemesh's C++ and .NET runtime libraries that have to be compatible with
the proxy types because the proxy types delegate most of their work to that runtime library. The runtime
library is currently at major version 3, hence the v3
label.
We strive to make the .NET proxy types as faithful to their underlying Java types as possible, but that does not mean that there
aren't any pitfalls. Some surprises are simply unavoidable. For example, there is simply no way you will ever
be able in .NET to use the .class
suffix to refer to a type; class
is a reserved name and
cannot be used like that. So how do you write .NET code that uses a Java type instance?
This tutorial will hopefully answer this and all similar questions that you might run into while using the .NET v3 proxy types.
Prerequisites
The focus of this tutorial is to introduce you to writing code with proxy types, not necessarily to teach you how to configure the application so it will actually run. We will have a lesson on how to configure your .NET project and as one of the tests we'll try to run the application you built but another tutorial deals with the application's runtime configuration in much more detail.
You should have access to a properly set up C# compiler if you are going to try to follow the step-by-step instructions but you can also just read the lessons, in which case a C# compiler is not necessary.
Lesson Plan
Lesson 1 |
Project Setup Learn what you need to do to use proxy types in your .NET projects. |
Lesson 2 |
Constructing Proxy Objects Learn how to instantiate a Java object through its proxy type. |
Lesson 3 |
The Proxy Object Lifecycle Learn what happens when a proxy object becomes eligible for garbage collection. |
Lesson 4 |
Interfaces Learn how to access static interface members through |
Lesson 5 |
Using Strings Learn how to use strings in connection with proxy types. |
Lesson 6 |
Dealing With Learn how to check whether a return value is |
Lesson 7 |
Accessing Fields Learn how to access fields in your proxy types. |
Lesson 8 |
Calling Methods Learn how to call methods on your proxy types. |
Lesson 9 |
Using Array Proxy Types Learn how to create arrays and access their elements. |
Lesson 10 |
Casting Between Proxy Types Learn how to cast a proxy object to a different proxy type. This
lesson discusses the |
Lesson 11 |
Handling Exceptions Learn how to handle exceptions thrown on the Java side. |
Lesson 12 |
Multi-threaded Execution Learn how to write proper multi-threaded code that avoids race conditions. |