本文整理了Java中io.sphere.sdk.models.Reference.ofResourceTypeIdAndIdAndObj
方法的一些代码示例,展示了Reference.ofResourceTypeIdAndIdAndObj
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.ofResourceTypeIdAndIdAndObj
方法的具体详情如下:
包路径:io.sphere.sdk.models.Reference
类名称:Reference
方法名:ofResourceTypeIdAndIdAndObj
暂无
代码示例来源:origin: commercetools/commercetools-jvm-sdk
static <T extends Identifiable<T>> Reference<T> ofResourceTypeIdAndObj(final String typeId, final T obj) {
return Reference.ofResourceTypeIdAndIdAndObj(typeId, obj.getId(), obj);
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
@Test
public void createAttributeFromReferenceSet(){
final Product product = SphereJsonUtils.readObjectFromResource("product1.json", Product.class);
final Reference<Product> expandedReference =
Reference.ofResourceTypeIdAndIdAndObj(Product.referenceTypeId(), UUID.randomUUID().toString(), product);
final HashSet<Reference<Product>> references = new HashSet<>();
references.add(expandedReference);
final Attribute attribute = Attribute.of("attrName", AttributeAccess.ofProductReferenceSet(), references);
assertThat(attribute.getValue(AttributeAccess.ofProductReferenceSet()).stream().allMatch(productReference -> productReference.getObj() != null)).isTrue();
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
@Test
public void implementEquals() throws Exception {
assertThat(newFilledReference()).isEqualTo(newFilledReference());
assertThat(newEmptyReference()).isEqualTo(newEmptyReference());
assertThat(newFilledReference()).isEqualTo(newEmptyReference());
assertThat(newFilledReference()).isEqualTo(newEmptyReference().filled(new TestEntity("other value")));
assertThat(Reference.<String>of(typeId, "Foo", "x")).isNotEqualTo(newEmptyReference());
assertThat(Reference.<String>ofResourceTypeIdAndIdAndObj(typeId, "Foo", "x")).isNotEqualTo(newEmptyReference());
}
内容来源于网络,如有侵权,请联系作者删除!