diff options
author | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-10-25 11:19:21 +0000 |
---|---|---|
committer | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-10-25 11:19:21 +0000 |
commit | 41e1e0307110d4258611fe186e1d8f12f1ea6cdf (patch) | |
tree | 3dc5ddfd8d506e4a7e5c4f39940da9c19a26bbd9 /org | |
parent | 250c65fb36f7d4f671c6dcc6981bc0c0e38678a7 (diff) | |
download | classpath-41e1e0307110d4258611fe186e1d8f12f1ea6cdf.tar.gz |
All helpers in jdk 1.5 contain the additional unuchecked_narrow method, discussed in http://www.omg.org/issues/issue4158.txt.
This path adds the method to our helper classes.
2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/BindingIteratorHelper.java,
org/omg/CosNaming/NamingContextExtHelper.java,
org/omg/CosNaming/NamingContextHelper.java,
org/omg/DynamicAny/DynAnyFactoryHelper.java,
org/omg/DynamicAny/DynAnyHelper.java,
org/omg/DynamicAny/DynArrayHelper.java,
org/omg/DynamicAny/DynEnumHelper.java,
org/omg/DynamicAny/DynFixedHelper.java,
org/omg/DynamicAny/DynSequenceHelper.java,
org/omg/DynamicAny/DynStructHelper.java,
org/omg/DynamicAny/DynUnionHelper.java,
org/omg/DynamicAny/DynValueHelper.java,
org/omg/IOP/CodecFactoryHelper.java,
org/omg/PortableInterceptor/CurrentHelper.java,
org/omg/PortableServer/ServantActivatorHelper.java,
org/omg/PortableServer/ServantLocatorHelper.java: Added
unchecked_narrow method.
Diffstat (limited to 'org')
-rw-r--r-- | org/omg/CosNaming/BindingIteratorHelper.java | 29 | ||||
-rw-r--r-- | org/omg/CosNaming/NamingContextExtHelper.java | 29 | ||||
-rw-r--r-- | org/omg/CosNaming/NamingContextHelper.java | 29 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynAnyFactoryHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynAnyHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynArrayHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynEnumHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynFixedHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynSequenceHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynStructHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynUnionHelper.java | 19 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynValueHelper.java | 19 | ||||
-rw-r--r-- | org/omg/IOP/CodecFactoryHelper.java | 19 | ||||
-rw-r--r-- | org/omg/PortableInterceptor/CurrentHelper.java | 20 | ||||
-rw-r--r-- | org/omg/PortableServer/ServantActivatorHelper.java | 21 | ||||
-rw-r--r-- | org/omg/PortableServer/ServantLocatorHelper.java | 19 |
16 files changed, 337 insertions, 0 deletions
diff --git a/org/omg/CosNaming/BindingIteratorHelper.java b/org/omg/CosNaming/BindingIteratorHelper.java index 1c3676977..64f7b4dfa 100644 --- a/org/omg/CosNaming/BindingIteratorHelper.java +++ b/org/omg/CosNaming/BindingIteratorHelper.java @@ -124,6 +124,35 @@ public abstract class BindingIteratorHelper return new _BindingIteratorStub(delegate); } } + + /** + * Narrow the given object to the BindingIterator. No type-checking is + * performed to verify that the object actually supports the requested type. + * The {@link BAD_OPERATION} will be thrown if unsupported operations are + * invoked on the new returned reference, but no failure is expected at the + * time of the unchecked_narrow. + * + * @param obj the object to cast. + * + * @return the casted binding iterator. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static BindingIterator unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof BindingIterator) + return (BindingIterator) obj; + else + { + // Do not call the _is_a(..). + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _BindingIteratorStub(delegate); + } + } /** * Read the exception from the given CDR stream. diff --git a/org/omg/CosNaming/NamingContextExtHelper.java b/org/omg/CosNaming/NamingContextExtHelper.java index 6f4d5bee0..86bf8c55d 100644 --- a/org/omg/CosNaming/NamingContextExtHelper.java +++ b/org/omg/CosNaming/NamingContextExtHelper.java @@ -125,6 +125,35 @@ public abstract class NamingContextExtHelper return new _NamingContextExtStub(delegate); } } + + /** + * Narrow the given object to the NamingContextExt. No type-checking is + * performed to verify that the object actually supports the requested type. + * The {@link BAD_OPERATION} will be thrown if unsupported operations are + * invoked on the new returned reference, but no failure is expected at the + * time of the unchecked_narrow. + * + * @param obj the object to cast. + * + * @return the casted NamingContextExt + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static NamingContextExt unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof NamingContextExt) + return (NamingContextExt) obj; + else + { + // Do not call the _is_a(..). + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _NamingContextExtStub(delegate); + } + } /** * Read the extended naming context from the given CDR input stream. diff --git a/org/omg/CosNaming/NamingContextHelper.java b/org/omg/CosNaming/NamingContextHelper.java index 2b383f13d..fb9b091a6 100644 --- a/org/omg/CosNaming/NamingContextHelper.java +++ b/org/omg/CosNaming/NamingContextHelper.java @@ -133,6 +133,35 @@ public abstract class NamingContextHelper else throw new BAD_PARAM(); } + + /** + * Narrow the given object to the NamingContext. No type-checking is performed + * to verify that the object actually supports the requested type. The + * {@link BAD_OPERATION} will be thrown if unsupported operations are invoked + * on the new returned reference, but no failure is expected at the time of + * the unchecked_narrow. + * + * @param obj the object to cast. + * + * @return the casted NamingContext. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static NamingContext unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof NamingContext) + return (NamingContext) obj; + else + { + // Do not call the _is_a(..). + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _NamingContextStub(delegate); + } + } /** * Read the naming context from the given CDR input stream. diff --git a/org/omg/DynamicAny/DynAnyFactoryHelper.java b/org/omg/DynamicAny/DynAnyFactoryHelper.java index e4942f41b..b8e3aafef 100644 --- a/org/omg/DynamicAny/DynAnyFactoryHelper.java +++ b/org/omg/DynamicAny/DynAnyFactoryHelper.java @@ -82,6 +82,25 @@ public abstract class DynAnyFactoryHelper + " is not a DynAnyFactory"); } } + + /** + * Narrow the given object to the DynAnyFactory. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynAnyFactory. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynAnyFactory unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the final_type code of the {@link DynAnyFactory}. diff --git a/org/omg/DynamicAny/DynAnyHelper.java b/org/omg/DynamicAny/DynAnyHelper.java index ca48cd4c5..73e2d9856 100644 --- a/org/omg/DynamicAny/DynAnyHelper.java +++ b/org/omg/DynamicAny/DynAnyHelper.java @@ -79,6 +79,25 @@ public abstract class DynAnyHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynAny"); } } + + /** + * Narrow the given object to the DynAny. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynAny. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynAny unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynAny}. diff --git a/org/omg/DynamicAny/DynArrayHelper.java b/org/omg/DynamicAny/DynArrayHelper.java index 0372b5851..f2892c856 100644 --- a/org/omg/DynamicAny/DynArrayHelper.java +++ b/org/omg/DynamicAny/DynArrayHelper.java @@ -78,6 +78,25 @@ public abstract class DynArrayHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynArray"); } } + + /** + * Narrow the given object to the DynArray. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynArray. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynArray unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynArray}. diff --git a/org/omg/DynamicAny/DynEnumHelper.java b/org/omg/DynamicAny/DynEnumHelper.java index 944d43757..8db1a2006 100644 --- a/org/omg/DynamicAny/DynEnumHelper.java +++ b/org/omg/DynamicAny/DynEnumHelper.java @@ -79,6 +79,25 @@ public abstract class DynEnumHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynEnum"); } } + + /** + * Narrow the given object to the DynEnum. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynEnum. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynEnum unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynEnum}. diff --git a/org/omg/DynamicAny/DynFixedHelper.java b/org/omg/DynamicAny/DynFixedHelper.java index 1d818d7b1..84bb59d9f 100644 --- a/org/omg/DynamicAny/DynFixedHelper.java +++ b/org/omg/DynamicAny/DynFixedHelper.java @@ -79,6 +79,25 @@ public abstract class DynFixedHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynFixed"); } } + + /** + * Narrow the given object to the DynFixed. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynFixed. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynFixed unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynFixed}. diff --git a/org/omg/DynamicAny/DynSequenceHelper.java b/org/omg/DynamicAny/DynSequenceHelper.java index c38a51f09..ad3013371 100644 --- a/org/omg/DynamicAny/DynSequenceHelper.java +++ b/org/omg/DynamicAny/DynSequenceHelper.java @@ -78,6 +78,25 @@ public abstract class DynSequenceHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynSequence"); } } + + /** + * Narrow the given object to the DynSequence. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynSequence. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynSequence unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynSequence}. diff --git a/org/omg/DynamicAny/DynStructHelper.java b/org/omg/DynamicAny/DynStructHelper.java index e4790b443..021c5d031 100644 --- a/org/omg/DynamicAny/DynStructHelper.java +++ b/org/omg/DynamicAny/DynStructHelper.java @@ -78,6 +78,25 @@ public abstract class DynStructHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynStruct"); } } + + /** + * Narrow the given object to the DynStruct. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynStruct. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynStruct unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynStruct}. diff --git a/org/omg/DynamicAny/DynUnionHelper.java b/org/omg/DynamicAny/DynUnionHelper.java index 794098333..8f924c086 100644 --- a/org/omg/DynamicAny/DynUnionHelper.java +++ b/org/omg/DynamicAny/DynUnionHelper.java @@ -78,6 +78,25 @@ public abstract class DynUnionHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynUnion"); } } + + /** + * Narrow the given object to the DynUnion. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynUnion. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynUnion unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynUnion}. diff --git a/org/omg/DynamicAny/DynValueHelper.java b/org/omg/DynamicAny/DynValueHelper.java index a6d7afaa9..026ca4990 100644 --- a/org/omg/DynamicAny/DynValueHelper.java +++ b/org/omg/DynamicAny/DynValueHelper.java @@ -78,6 +78,25 @@ public abstract class DynValueHelper throw new BAD_PARAM(obj.getClass().getName() + " is not a DynValue"); } } + + /** + * Narrow the given object to the DynValue. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted DynValue. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static DynValue unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Get the type code of the {@link DynValue}. diff --git a/org/omg/IOP/CodecFactoryHelper.java b/org/omg/IOP/CodecFactoryHelper.java index d5c55a264..fea0b887b 100644 --- a/org/omg/IOP/CodecFactoryHelper.java +++ b/org/omg/IOP/CodecFactoryHelper.java @@ -120,6 +120,25 @@ public abstract class CodecFactoryHelper throw bad; } } + + /** + * Narrow the given object to the CodecFactory. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted CodecFactory. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static CodecFactory unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * This should read the CodecFactory from the CDR intput stream, diff --git a/org/omg/PortableInterceptor/CurrentHelper.java b/org/omg/PortableInterceptor/CurrentHelper.java index b6bd087ca..df3bcaef7 100644 --- a/org/omg/PortableInterceptor/CurrentHelper.java +++ b/org/omg/PortableInterceptor/CurrentHelper.java @@ -47,6 +47,7 @@ import org.omg.CORBA.ORB; import org.omg.CORBA.TypeCode; import org.omg.CORBA.portable.InputStream; import org.omg.CORBA.portable.OutputStream; +import org.omg.PortableServer.ServantActivator; /** * The helper operations for the CORBA object {@link Current}. @@ -125,6 +126,25 @@ public abstract class CurrentHelper throw new BAD_PARAM("Not a Current"); } } + + /** + * Narrow the given object to the Current. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted Current. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static Current unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * Not supported for compatibility reasons. diff --git a/org/omg/PortableServer/ServantActivatorHelper.java b/org/omg/PortableServer/ServantActivatorHelper.java index f2779b1b5..8aa58b2f6 100644 --- a/org/omg/PortableServer/ServantActivatorHelper.java +++ b/org/omg/PortableServer/ServantActivatorHelper.java @@ -41,6 +41,7 @@ package org.omg.PortableServer; import gnu.CORBA.Minor; import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.MARSHAL; import org.omg.CORBA.ORB; @@ -114,6 +115,26 @@ public abstract class ServantActivatorHelper throw bad; } } + + /** + * Narrow the given object to the ServantActivator. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted ServantActivator. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static ServantActivator unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + /** * This should read the servant activator, but it cannot be transferred diff --git a/org/omg/PortableServer/ServantLocatorHelper.java b/org/omg/PortableServer/ServantLocatorHelper.java index 2195e7899..082c4c586 100644 --- a/org/omg/PortableServer/ServantLocatorHelper.java +++ b/org/omg/PortableServer/ServantLocatorHelper.java @@ -115,6 +115,25 @@ public abstract class ServantLocatorHelper throw bad; } } + + /** + * Narrow the given object to the ServantLocator. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). + * + * @param obj the object to cast. + * + * @return the casted ServantLocator. + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static ServantLocator unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } /** * This should read the servant locator, but it cannot be transferred |