当前位置: 首页>>代码示例>>Java>>正文


Java RepositoryId.createForAnyType方法代码示例

本文整理汇总了Java中com.sun.corba.se.impl.util.RepositoryId.createForAnyType方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryId.createForAnyType方法的具体用法?Java RepositoryId.createForAnyType怎么用?Java RepositoryId.createForAnyType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.corba.se.impl.util.RepositoryId的用法示例。


在下文中一共展示了RepositoryId.createForAnyType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: narrow

import com.sun.corba.se.impl.util.RepositoryId; //导入方法依赖的package包/类
/**
 * Checks to ensure that an object of a remote or abstract interface type
 * can be cast to a desired type.
 * @param narrowFrom the object to check.
 * @param narrowTo the desired type.
 * @return an object which can be cast to the desired type.
 * @throws ClassCastException if narrowFrom cannot be cast to narrowTo.
 */
public java.lang.Object narrow ( java.lang.Object narrowFrom,
    java.lang.Class narrowTo) throws ClassCastException
{
    java.lang.Object result = null;

    if (narrowFrom == null)
        return null;

    if (narrowTo == null)
        throw new NullPointerException("invalid argument");

    try {
        if (narrowTo.isAssignableFrom(narrowFrom.getClass()))
            return narrowFrom;

        // Is narrowTo an interface that might be
        // implemented by a servant running on iiop?
        if (narrowTo.isInterface() &&
            narrowTo != java.io.Serializable.class &&
            narrowTo != java.io.Externalizable.class) {

            org.omg.CORBA.Object narrowObj
                = (org.omg.CORBA.Object) narrowFrom;

            // Create an id from the narrowTo type...
            String id = RepositoryId.createForAnyType(narrowTo);

            if (narrowObj._is_a(id)) {
                return Utility.loadStub(narrowObj,narrowTo);
            } else {
                throw new ClassCastException( "Object is not of remote type " +
                    narrowTo.getName() ) ;
            }
        } else {
            throw new ClassCastException( "Class " + narrowTo.getName() +
                " is not a valid remote interface" ) ;
        }
    } catch(Exception error) {
        ClassCastException cce = new ClassCastException() ;
        cce.initCause( error ) ;
        throw cce ;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:52,代码来源:PortableRemoteObject.java

示例2: createForAnyType

import com.sun.corba.se.impl.util.RepositoryId; //导入方法依赖的package包/类
public String createForAnyType(Class type) {
    return RepositoryId.createForAnyType(type);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:RepIdDelegator.java

示例3: createForAnyType

import com.sun.corba.se.impl.util.RepositoryId; //导入方法依赖的package包/类
public String createForAnyType(Class cl)
{
   return RepositoryId.createForAnyType(cl);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:ValueHandlerImpl.java

示例4: setRepositoryID

import com.sun.corba.se.impl.util.RepositoryId; //导入方法依赖的package包/类
protected boolean setRepositoryID() {

        // First, load the class...

        if (!initClass()) {
            return false;
        }

        // Now make the repositoryID and return success...

        repositoryID = RepositoryId.createForAnyType(ourClass);
        return true;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Type.java


注:本文中的com.sun.corba.se.impl.util.RepositoryId.createForAnyType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。