本文整理汇总了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 ;
}
}
示例2: createForAnyType
import com.sun.corba.se.impl.util.RepositoryId; //导入方法依赖的package包/类
public String createForAnyType(Class type) {
return RepositoryId.createForAnyType(type);
}
示例3: createForAnyType
import com.sun.corba.se.impl.util.RepositoryId; //导入方法依赖的package包/类
public String createForAnyType(Class cl)
{
return RepositoryId.createForAnyType(cl);
}
示例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;
}