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

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

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

Assert.isNull介绍

[英]Assert that an object is null .

Assert.isNull(value);

[中]断言对象为null

Assert.isNull(value);

代码示例

代码示例来源:origin: stormpath/stormpath-sdk-java

/**
 * Assert that an object is <code>null</code> .
 * <pre class="code">Assert.isNull(value);</pre>
 * @param object the object to check
 * @throws IllegalArgumentException if the object is not <code>null</code>
 */
public static void isNull(Object object) {
  isNull(object, "[Assertion failed] - the object argument must be null");
}

代码示例来源:origin: stormpath/stormpath-sdk-java

public Map<String, String> createUnmaterializedReference (String resourceName, Resource resource){
    Assert.notNull(resource, "Resource argument cannot be null.");
    Assert.isNull(resource.getHref(), "Resource "+ resourceName +" must be unmaterialized and not have an 'href' property.");

    Map<String, String> reference = ResourceUtil.filterNonStringvaluesWithiResourceDirtyProperties(resource);
    return reference;
  }
}

代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl

public Map<String, String> createUnmaterializedReference (String resourceName, Resource resource){
    Assert.notNull(resource, "Resource argument cannot be null.");
    Assert.isNull(resource.getHref(), "Resource "+ resourceName +" must be unmaterialized and not have an 'href' property.");

    Map<String, String> reference = ResourceUtil.filterNonStringvaluesWithiResourceDirtyProperties(resource);
    return reference;
  }
}

代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl

/**
 * This method is able to set a Reference to a resource (<code>value</code>) even though resource has not yet an href value
 * <p>Note that this is method is analogous to the {@link #setResourceProperty(ResourceReference, Resource)} method (in fact
 * it relies on it when the resource alredy has an href value) but this method does not complain when the href of the resource is missing.</p>
 *
 * @param property the property whose value is going to be set to <code>value</code>
 * @param value    the value to be set to <code>property</code>
 * @since 1.1.0
 */
protected <T extends Resource> void setMaterializableResourceProperty(ResourceReference<T> property, Resource value) {
  Assert.notNull(property, "Property argument cannot be null.");
  Assert.isNull(value.getHref(), "Resource must not have an 'href' property ");
  if (((AbstractResource) value).isMaterialized()) {
    setResourceProperty(property, value);
  } else {
    String name = property.getName();
    Map<String, String> reference = this.referenceFactory.createUnmaterializedReference(name, value);
    setProperty(name, reference);
  }
}

代码示例来源:origin: stormpath/stormpath-sdk-java

/**
 * This method is able to set a Reference to a resource (<code>value</code>) even though resource has not yet an href value
 * <p>Note that this is method is analogous to the {@link #setResourceProperty(ResourceReference, Resource)} method (in fact
 * it relies on it when the resource alredy has an href value) but this method does not complain when the href of the resource is missing.</p>
 *
 * @param property the property whose value is going to be set to <code>value</code>
 * @param value    the value to be set to <code>property</code>
 * @since 1.1.0
 */
protected <T extends Resource> void setMaterializableResourceProperty(ResourceReference<T> property, Resource value) {
  Assert.notNull(property, "Property argument cannot be null.");
  Assert.isNull(value.getHref(), "Resource must not have an 'href' property ");
  if (((AbstractResource) value).isMaterialized()) {
    setResourceProperty(property, value);
  } else {
    String name = property.getName();
    Map<String, String> reference = this.referenceFactory.createUnmaterializedReference(name, value);
    setProperty(name, reference);
  }
}

相关文章