io.sphere.sdk.models.Reference.ofResourceTypeIdAndIdAndObj()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(122)

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

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

相关文章