diff options
| author | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-05-25 17:24:30 +0000 |
|---|---|---|
| committer | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-05-25 17:24:30 +0000 |
| commit | 875b193dc099668417fba94e2a3622c05f8e8c70 (patch) | |
| tree | 2d31680fb52ad6f5e5dc3f59220d32a56c3ef773 /gnu/CORBA/gnuAny.java | |
| parent | d27b6df1d1b7e8d4091cf52af8c28d99c2dfa85b (diff) | |
| download | classpath-875b193dc099668417fba94e2a3622c05f8e8c70.tar.gz | |
2005-05-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/ValueBaseHelper.java,
org/omg/CORBA/ValueBaseHolder.java,
org/omg/CORBA/portable/ValueBase.java: New files.
* gnu/CORBA/gnuAny.java (insert_Value, extract_Value):
Implemented methods.
Diffstat (limited to 'gnu/CORBA/gnuAny.java')
| -rw-r--r-- | gnu/CORBA/gnuAny.java | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/gnu/CORBA/gnuAny.java b/gnu/CORBA/gnuAny.java index 5b1e6949a..7997265df 100644 --- a/gnu/CORBA/gnuAny.java +++ b/gnu/CORBA/gnuAny.java @@ -52,7 +52,6 @@ import org.omg.CORBA.FloatHolder; import org.omg.CORBA.IntHolder; import org.omg.CORBA.LongHolder; import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.NO_IMPLEMENT; import org.omg.CORBA.ORB; import org.omg.CORBA.ObjectHolder; import org.omg.CORBA.Principal; @@ -63,6 +62,7 @@ import org.omg.CORBA.TCKind; import org.omg.CORBA.TypeCode; import org.omg.CORBA.TypeCodeHolder; import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.ValueBaseHolder; import org.omg.CORBA.portable.Streamable; import java.io.IOException; @@ -265,11 +265,26 @@ public class gnuAny return ((TypeCodeHolder) has).value; } + /** + * Extract the stored value type. + * + * @return the previously stored value type. + * + * @throws BAD_OPERATION if the Any contains something different. + * + * @see org.omg.CORBA.portable.ValueBase + */ public Serializable extract_Value() throws BAD_OPERATION { - /**@todo Implement this org.omg.CORBA.Any abstract method*/ - throw new java.lang.UnsupportedOperationException("Method extract_Value() not yet implemented."); + try + { + return ((ValueBaseHolder) has).value; + } + catch (ClassCastException ex) + { + return new BAD_OPERATION("Value type expected"); + } } /** {@inheritDoc} */ @@ -474,17 +489,18 @@ public class gnuAny /** {@inheritDoc} */ public void insert_Value(Serializable x, TypeCode typecode) { - resetTypes(); - - /**@todo Implement this org.omg.CORBA.Any abstract method*/ + type(typecode); + insert_Value(x); } /** {@inheritDoc} */ public void insert_Value(Serializable x) { resetTypes(); - - /**@todo Implement this org.omg.CORBA.Any abstract method*/ + if (has instanceof ValueBaseHolder) + ((ValueBaseHolder) has).value = x; + else + has = new ValueBaseHolder(x); } /** @@ -710,14 +726,14 @@ public class gnuAny { has = holderFactory.createHolder(a_type); if (has == null) - { - // Use the Universal Holder that reads till the end of stream. - // This works with the extract/insert pair of the typical - // Helper. - cdrBufOutput buffer = new cdrBufOutput(); - buffer.setOrb(orb); - has = new universalHolder(buffer); - } + { + // Use the Universal Holder that reads till the end of stream. + // This works with the extract/insert pair of the typical + // Helper. + cdrBufOutput buffer = new cdrBufOutput(); + buffer.setOrb(orb); + has = new universalHolder(buffer); + } } type(a_type); has._read(input); @@ -799,4 +815,4 @@ public class gnuAny typecode = null; xKind = -1; } -} +}
\ No newline at end of file |
