com.stormpath.sdk.lang.Assert.isAssignable()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中com.stormpath.sdk.lang.Assert.isAssignable()方法的一些代码示例,展示了Assert.isAssignable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.isAssignable()方法的具体详情如下:
包路径:com.stormpath.sdk.lang.Assert
类名称:Assert
方法名:isAssignable

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);
}

相关文章