Date: Fri, 29 Mar 2024 06:48:14 +0000 (UTC) Message-ID: <2126808695.24903.1711694894776@ae5f4610bf64> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_24902_858213907.1711694894776" ------=_Part_24902_858213907.1711694894776 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
In Java terminology, a serializable object typically refers to =
an object that implements the java.io.Serializable
interface a=
nd therefore supports serialization to and from a byte stream. All Java cla=
sses generated from Slice definitions implement the java.io.Serializa=
ble
interface.
In addition to serializing Slice types, applications may also need to in= corporate foreign types into their Slice definitions. Ice allows you to pas= s Java serializable objects= directly as operation parameters or as fields of another data type. Fo= r example:
["java:serializable:SomePackage.JavaClass"] sequence<byte> JavaObj; struct MyStruct { int i; JavaObj o; }; interface Example { void op(JavaObj inObj, MyStruct = ;s, out JavaObj outObj); };
The generated code for MyStruct
contains a member int
and a member o
of typ=
e SomePackage.JavaClass
:
public final class MyStruct im= plements java.lang.Cloneable { public int i; public SomePackage.JavaClass o; // ... }
Similarly, the signature for op
has parameters of type MyStruct
for the in-parameters, and Ice.Holder<class>=
code>.)
void op(SomePackage.JavaClass inObj, MyStruct s, Ice.Holder<SomePackage.J= avaClass> outObj);
Of course, your client and server code must have an implementation of Class
that derives from java.io.Serializa=
ble
:
package SomePackage; public class JavaClass implements java.io.Serializable&= nbsp;{ // ... }
You can implement this class in any way you see fit =E2=80=94 the Ice ru= n time does not place any other requirements on the implementation.