本文整理了Java中com.stormpath.sdk.lang.Assert.isAssignable()
方法的一些代码示例,展示了Assert.isAssignable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.isAssignable()
方法的具体详情如下:
包路径:com.stormpath.sdk.lang.Assert
类名称:Assert
方法名:isAssignable
[英]Assert that superType.isAssignableFrom(subType)
is true
.
Assert.isAssignable(Number.class, myClass);
[中]断言superType.isAssignableFrom(subType)
是true
Assert.isAssignable(Number.class, myClass);
代码示例来源:origin: stormpath/stormpath-sdk-java
/**
* Assert that <code>superType.isAssignableFrom(subType)</code> is <code>true</code>.
* <pre class="code">Assert.isAssignable(Number.class, myClass);</pre>
* @param superType the super type to check
* @param subType the sub type to check
* @throws IllegalArgumentException if the classes are not assignable
*/
public static void isAssignable(Class superType, Class subType) {
isAssignable(superType, subType, "");
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
/**
* @since 1.0.beta
*/
@Override
public Directory createDirectory(CreateDirectoryRequest createDirectoryRequest) {
Assert.notNull(createDirectoryRequest, "createDirectoryRequest cannot be null.");
Assert.notNull(createDirectoryRequest.getDirectory(), "the specified directory cannot be null.");
Directory directory = createDirectoryRequest.getDirectory();
if(createDirectoryRequest.getProvider() != null) {
Assert.isAssignable(DefaultDirectory.class, directory.getClass(), "the directory instance is of " +
"an unidentified type. The specified provider cannot be set to it: " + createDirectoryRequest.getDirectory());
((DefaultDirectory)directory).setProvider(createDirectoryRequest.getProvider());
}
return getDataStore().create("/" + DIRECTORIES.getName(), directory);
}
代码示例来源:origin: stormpath/stormpath-sdk-java
/**
* @since 1.0.beta
*/
@Override
public Directory createDirectory(CreateDirectoryRequest createDirectoryRequest) {
Assert.notNull(createDirectoryRequest, "createDirectoryRequest cannot be null.");
Assert.notNull(createDirectoryRequest.getDirectory(), "the specified directory cannot be null.");
Directory directory = createDirectoryRequest.getDirectory();
if(createDirectoryRequest.getProvider() != null) {
Assert.isAssignable(DefaultDirectory.class, directory.getClass(), "the directory instance is of " +
"an unidentified type. The specified provider cannot be set to it: " + createDirectoryRequest.getDirectory());
((DefaultDirectory)directory).setProvider(createDirectoryRequest.getProvider());
}
return getDataStore().create("/" + DIRECTORIES.getName(), directory);
}
内容来源于网络,如有侵权,请联系作者删除!