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

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

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

Reference.filled介绍

暂无

代码示例

代码示例来源:origin: io.sphere.jvmsdk/common

public Reference<T> filled(final T obj) {
  return filled(Optional.ofNullable(obj));
}

代码示例来源:origin: io.sphere.sdk.jvm/common

public Reference<T> filled(final T obj) {
  return filled(Optional.ofNullable(obj));
}

代码示例来源:origin: io.sphere.sdk.jvm/models

private SetCustomerGroup(final Optional<Reference<CustomerGroup>> customerGroup) {
  super("setCustomerGroup");
  this.customerGroup = customerGroup.map(e -> e.filled(Optional.empty()));
}

代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models

private SetCustomerGroup(final Referenceable<CustomerGroup> customerGroup) {
  super("setCustomerGroup");
  this.customerGroup = Optional.ofNullable(customerGroup)
      .map(x -> x.toReference().filled(null))
      .orElse(null);
}

代码示例来源:origin: io.sphere.sdk.jvm/sphere-models

private SetCustomerGroup(final Referenceable<CustomerGroup> customerGroup) {
  super("setCustomerGroup");
  this.customerGroup = Optional.ofNullable(customerGroup)
      .map(x -> x.toReference().filled(null))
      .orElse(null);
}

代码示例来源:origin: io.sphere.sdk.jvm/common

public static <T> Reference<T> of(final String typeId, final String id, T obj) {
  return Reference.<T>of(typeId, id).filled(obj);
}

代码示例来源:origin: io.sphere.sdk.jvm/sphere-models

private ChangeParent(final Referenceable<Category> parent) {
  super("changeParent");
  this.parent = parent.toReference().filled(null);
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

private SetCustomerGroup(final Referenceable<CustomerGroup> customerGroup) {
  super("setCustomerGroup");
  this.customerGroup = Optional.ofNullable(customerGroup)
      .map(x -> x.toReference().filled(null))
      .orElse(null);
}

代码示例来源:origin: io.sphere.sdk.jvm/models

private ChangeParent(final Referenceable<Category> parent) {
  super("changeParent");
  this.parent = parent.toReference().filled(Optional.empty());
}

代码示例来源:origin: io.sphere.sdk.jvm/products

private ChangeParent(final Referenceable<Category> parent) {
  super("changeParent");
  this.parent = parent.toReference().filled(Optional.empty());
}

代码示例来源:origin: io.sphere.jvmsdk/common

public static <T> Reference<T> of(final String typeId, final String id, T obj) {
  return Reference.<T>of(typeId, id).filled(obj);
}

代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models

@Override
  public JsonNode serialize(final T t) {
    return mapper().valueToTree(t.toReference().filled(null));
  }
}

代码示例来源:origin: io.sphere.sdk.jvm/models

@Override
  public JsonNode serialize(final T t) {
    return mapper().valueToTree(t.toReference().filled(Optional.empty()));
  }
}

代码示例来源:origin: io.sphere.sdk.jvm/products

@Override
  public JsonNode serialize(final T t) {
    return mapper().valueToTree(t.toReference().filled(Optional.empty()));
  }
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Override
  public JsonNode serialize(final T t) {
    return mapper().valueToTree(t.toReference().filled(null));
  }
}

代码示例来源:origin: io.sphere.sdk.jvm/sphere-models

@Override
  public JsonNode serialize(final T t) {
    return mapper().valueToTree(t.toReference().filled(null));
  }
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

private Reference<TestEntity> newFilledReference() {
  return newEmptyReference().filled(new TestEntity("value"));
}

代码示例来源: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());
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void attributeShouldKeepExpansions() throws Exception {
  final AttributeAccess<Reference<Product>> access = AttributeAccess.ofProductReference();
  final NamedAttributeAccess<Reference<Product>> namedAccess = access.ofName("foo");
  assertThat(EXPANDED_PRODUCT_REFERENCE.getObj()).overridingErrorMessage("product reference is expanded").isNotNull();
  final Attribute attribute = Attribute.of(namedAccess, EXPANDED_PRODUCT_REFERENCE);
  assertThat(attribute.getValue(access).getObj()).isNotNull();
  final String jsonFilledRef = SphereJsonUtils.toJsonString(EXPANDED_PRODUCT_REFERENCE);
  final String jsonEmptyRef = SphereJsonUtils.toJsonString(EXPANDED_PRODUCT_REFERENCE.filled(null));
  assertThat(jsonFilledRef)
      .overridingErrorMessage("references are not expanded if serialized")
      .doesNotContain(EXPANDED_PRODUCT_REFERENCE.getObj().getMasterData().getStaged().getName().get(Locale.ENGLISH))
      .isEqualTo(jsonEmptyRef);
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void productReferenceAttribute() throws Exception {
  withEmptyProductType(client(), "productReferenceAttribute-testcase", productType -> {
    final ProductVariantDraft masterVariant = ProductVariantDraftBuilder.of().build();
    final ProductDraft productDraft = ProductDraftBuilder.of(productType, LABEL, SphereTestUtils.randomSlug(), masterVariant).build();
    final Product product = client().executeBlocking(ProductCreateCommand.of(productDraft));
    testSingleAndSet(AttributeAccess.ofProductReference(), AttributeAccess.ofProductReferenceSet(),
        asSet(product.toReference().filled(null)),
        ReferenceAttributeType.ofProduct(),
        AttributeDefinitionBuilder.of("productReference", LABEL, ReferenceAttributeType.ofProduct()).build());
  });
}

相关文章