diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/ObjectHolder.java | 51 | ||||
-rw-r--r-- | java/src/Ice/ObjectHolderBase.java | 49 |
2 files changed, 63 insertions, 37 deletions
diff --git a/java/src/Ice/ObjectHolder.java b/java/src/Ice/ObjectHolder.java index 6c68ce6e010..22bc22a9fc6 100644 --- a/java/src/Ice/ObjectHolder.java +++ b/java/src/Ice/ObjectHolder.java @@ -12,7 +12,7 @@ package Ice; /** * Holder class for Ice objects that are out- or inout-parameters. **/ -public final class ObjectHolder +public final class ObjectHolder extends ObjectHolderBase<Ice.Object> { /** * Instantiates the class with a <code>null</code> value. @@ -28,52 +28,29 @@ public final class ObjectHolder public ObjectHolder(Ice.Object value) { - this.value = value; + super(value); } /** - * This class allows the unmarshaling code to patch the reference - * to the Ice object in this holder once the Ice object has been unmarshaled. + * Sets the Ice object of this holder to the passed instance. + * + * @param v The new object for this holder. **/ - public class Patcher implements IceInternal.Patcher + public void + patch(Ice.Object v) { - /** - * Sets the Ice object of this holder to the passed instance. - * - * @param v The new object for this holder. - **/ - public void - patch(Ice.Object v) - { - value = v; - } - - /** - * Returns the Slice type ID of the most-derived Slice type supported - * by this instance. - * - * @return The Slice type ID. - **/ - public String - type() - { - return Ice.ObjectImpl.ice_staticId(); - } + value = v; } /** - * Returns the patcher for this Ice object. + * Returns the Slice type ID of the most-derived Slice type supported + * by this instance. * - * @return The patcher for this Ice object. + * @return The Slice type ID. **/ - public Patcher - getPatcher() + public String + type() { - return new Patcher(); + return Ice.ObjectImpl.ice_staticId(); } - - /** - * The Ice object stored by this holder. - **/ - public Ice.Object value; } diff --git a/java/src/Ice/ObjectHolderBase.java b/java/src/Ice/ObjectHolderBase.java new file mode 100644 index 00000000000..7b7b411e386 --- /dev/null +++ b/java/src/Ice/ObjectHolderBase.java @@ -0,0 +1,49 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Holder base class for Ice objects that are in- or inout-parameters. + **/ +public abstract class ObjectHolderBase<T extends Ice.Object> implements ReadObjectCallback, IceInternal.Patcher +{ + /** + * Instantiates the class with a <code>null</code> value. + **/ + public + ObjectHolderBase() + { + } + + /** + * Instantiates the class with the passed Ice object. + **/ + public + ObjectHolderBase(T obj) + { + this.value = obj; + } + + /** + * Sets the Ice object of this holder to the passed instance. + * + * @param obj The new object for this holder. + **/ + public void + invoke(Ice.Object obj) + { + patch(obj); + } + + /** + * The Ice object stored by this holder. + **/ + public T value; +} |