/** * Fill a builder with attribute values from the provided {@code EventOptions} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(EventOptions instance) { Preconditions.checkNotNull(instance, "instance"); Optional<String> datacenterOptional = instance.getDatacenter(); if (datacenterOptional.isPresent()) { datacenter(datacenterOptional); } Optional<String> nodeFilterOptional = instance.getNodeFilter(); if (nodeFilterOptional.isPresent()) { nodeFilter(nodeFilterOptional); } Optional<String> serviceFilterOptional = instance.getServiceFilter(); if (serviceFilterOptional.isPresent()) { serviceFilter(serviceFilterOptional); } Optional<String> tagFilterOptional = instance.getTagFilter(); if (tagFilterOptional.isPresent()) { tagFilter(tagFilterOptional); } return this; }