/** * Fill a builder with attribute values from the provided {@code RawMetrics} 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 RawMetrics.Builder from(RawMetrics instance) { Objects.requireNonNull(instance, "instance"); integrationId(instance.getIntegrationId()); version(instance.getVersion()); pod(instance.getPod()); messages(instance.getMessages()); errors(instance.getErrors()); Optional<Date> startDateOptional = instance.getStartDate(); if (startDateOptional.isPresent()) { startDate(startDateOptional); } Optional<Date> resetDateOptional = instance.getResetDate(); if (resetDateOptional.isPresent()) { resetDate(resetDateOptional); } Optional<Date> lastProcessedOptional = instance.getLastProcessed(); if (lastProcessedOptional.isPresent()) { lastProcessed(lastProcessedOptional); } return (RawMetrics.Builder) this; }