summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/SequencePatcher.java
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2003-05-24 04:33:37 +0000
committerMark Spruiell <mes@zeroc.com>2003-05-24 04:33:37 +0000
commit0040a0d2ee9506fd523ddc35dc91deca40167a30 (patch)
tree0a279536a451d1b60ea2ea2a00655ec06c57456c /java/src/IceInternal/SequencePatcher.java
parentuse the ClassCastException as the cause for the NoObjectFactoryException (diff)
downloadice-0040a0d2ee9506fd523ddc35dc91deca40167a30.tar.bz2
ice-0040a0d2ee9506fd523ddc35dc91deca40167a30.tar.xz
ice-0040a0d2ee9506fd523ddc35dc91deca40167a30.zip
adding generic sequence patchers
Diffstat (limited to 'java/src/IceInternal/SequencePatcher.java')
-rw-r--r--java/src/IceInternal/SequencePatcher.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/java/src/IceInternal/SequencePatcher.java b/java/src/IceInternal/SequencePatcher.java
new file mode 100644
index 00000000000..5fc5b9300d2
--- /dev/null
+++ b/java/src/IceInternal/SequencePatcher.java
@@ -0,0 +1,53 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+package IceInternal;
+
+public class SequencePatcher implements Patcher
+{
+ public
+ SequencePatcher(java.lang.Object[] seq, Class cls, String type, int index)
+ {
+ _seq = seq;
+ _cls = cls;
+ _type = type;
+ _index = index;
+ }
+
+ public void
+ patch(Ice.Object v)
+ {
+ //
+ // Raise ClassCastException if the element doesn't match the expected type.
+ //
+ if(!_cls.isInstance(v))
+ {
+ throw new ClassCastException("expected element of type " + _cls.getName() + " but received " +
+ v.getClass().getName());
+ }
+
+ _seq[_index] = v;
+ }
+
+ public String
+ type()
+ {
+ return _type;
+ }
+
+ private java.lang.Object[] _seq;
+ private Class _cls;
+ private String _type;
+ private int _index;
+}