summaryrefslogtreecommitdiff
path: root/java/demo/Ice/value/Client.java
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2012-11-20 10:57:44 -0330
committerDwayne Boone <dwayne@zeroc.com>2012-11-20 10:57:44 -0330
commit4c5255c1ab05da2a775f9e01b2da2143741df3d2 (patch)
tree502e839455de10c62c500612159425a6964fdfdd /java/demo/Ice/value/Client.java
parentICE-4965: added Python Ice/metrics demo (diff)
downloadice-4c5255c1ab05da2a775f9e01b2da2143741df3d2.tar.bz2
ice-4c5255c1ab05da2a775f9e01b2da2143741df3d2.tar.xz
ice-4c5255c1ab05da2a775f9e01b2da2143741df3d2.zip
ICE-4963 added example of "preserve-slice" to value demo
Diffstat (limited to 'java/demo/Ice/value/Client.java')
-rw-r--r--java/demo/Ice/value/Client.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/java/demo/Ice/value/Client.java b/java/demo/Ice/value/Client.java
index 47da56bdcea..d6eaef9878c 100644
--- a/java/demo/Ice/value/Client.java
+++ b/java/demo/Ice/value/Client.java
@@ -165,6 +165,23 @@ public class Client extends Ice.Application
derived.printUppercase();
System.out.println();
+ System.out.println("Now let's make sure that slice is preserved with [\"preserve-slice\"]");
+ System.out.println("metadata. We create a derived type on the client and pass it to the");
+ System.out.println("server, which does not have a factory for the derived type. We do a");
+ System.out.println("class cast to make sure we can still access the derived type when");
+ System.out.println("it has been returned from the server.");
+ System.out.println("[press enter]");
+ readline(in);
+
+ ClientPrinter clientp = new ClientPrinterI();
+ clientp.message = "a message 4 u";
+ communicator().addObjectFactory(factory, Demo.ClientPrinter.ice_staticId());
+
+ derivedAsBase = initial.updatePrinterMessage(clientp);
+ clientp = (Demo.ClientPrinter)derivedAsBase;
+ System.out.println("==> " + clientp.message);
+
+ System.out.println();
System.out.println("Finally, we try the same again, but instead of returning the");
System.out.println("derived object, we throw an exception containing the derived");
System.out.println("object.");