/** * Sets or replaces all elements for {@link Container#getChilds() childs} list. * @param elements An iterable of childs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("childs") public final Builder childs(Iterable<? extends Element> elements) { this.childs = ImmutableList.builder(); return addAllChilds(elements); }
/** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the <em>Jackson</em>-binding infrastructure */ @Deprecated @JsonCreator(mode = JsonCreator.Mode.DELEGATING) static ImmutableContainer fromJson(Json json) { ImmutableContainer.Builder builder = ImmutableContainer.builder(); if (json.childs != null) { builder.addAllChilds(json.childs); } if (json.isSharedIsSet) { builder.isShared(json.isShared); } if (json.name != null) { builder.name(json.name); } if (json.description != null) { builder.description(json.description); } return builder.build(); }
private void from(Object object) { if (object instanceof ShareableElement) { ShareableElement instance = (ShareableElement) object; isShared(instance.isShared()); } if (object instanceof IContainer) { IContainer instance = (IContainer) object; addAllChilds(instance.getChilds()); } if (object instanceof Element) { Element instance = (Element) object; name(instance.getName()); Optional<String> descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } } }