Summary: Enabling interoperability between Java and .NET - creating interoperable class, supported types for matching and interoperability.
Overview
Even though the space is implemented in Java, you can use a .NET proxy to read and write .NET objects from/to the space. Under the hood, the proxy serializes the object in a special cross-platform format, thus allowing the space to recognize the fields in your object whose type is cross-platform. This enables the space to perform queries and return matching results.
This implementation enables a powerful feature - if you implement a matching class in Java with the same name and fields, you can use a Java proxy to read an object written from the .NET proxy (or vice versa). So in fact, the space can be used as an integration platform between .NET and Java.
The .NET-Java example demonstrates many .NET-Java interoperability fetaures. For more details, see GigaSpaces Starter Examples; .NET; DotNetJava
Creating Interoperable Class
The following guidelines and restrictions should be followed in order to enable platform interoperability:
- The full class name (including package\namespace) in .NET and Java must be identical.
Java packages use a different naming convention than .NET namespaces.
- Both classes should have the exact same fields, with matching types.
In Java, only properties are serialized into the space. In .NET, both fields and properties are serialized, so you can mix and match them.
Java properties usually start with a lowercase letter, whereas .NET properties usually start with an uppercase letter.
- Only the types listed in the table below are supported. If one of your fields uses a different type, you can use the class only in a homogeneous environment.
Arrays are supported using the Java primitive equivalent of each type listed in the table below. For example, the equivalent of java.lang.Byte is byte. (
See how this is demostrated in the DotNetJava example.)
Guid/UUID arrays are supported in GigaSpaces 6.0.1 and onwards.
You can also use .NET enumerations, which are treated as their underlying .NET type. Java enums are not supported.
If your class contains a field whose type is not in the table, you can use SpaceExclude to exclude it from the space.
Some of the types have different charactaristics in .NET and Java (signed\unsigned, nullable\not nullable, precision, etc.) This can lead to runtime exceptions (e.g. trying to store null in a .NET structure) or unexpected results (e.g. copying values between signed and unsigned fields).
Supported Types for Matching and Interoperability
The following types are supported by the space for matching and interoperability: