All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.commercetools.history.models.common.Parcel Maven / Gradle / Ivy

There is a newer version: 17.15.1
Show newest version

package com.commercetools.history.models.common;

import java.time.*;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

import javax.annotation.Nullable;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;

import io.vrap.rmf.base.client.utils.Generated;

/**
 * Parcel
 *
 * 
* Example to create an instance using the builder pattern *
*

 *     Parcel parcel = Parcel.builder()
 *             .id("{id}")
 *             .createdAt("{createdAt}")
 *             .measurements(measurementsBuilder -> measurementsBuilder)
 *             .trackingData(trackingDataBuilder -> trackingDataBuilder)
 *             .plusItems(itemsBuilder -> itemsBuilder)
 *             .build()
 * 
*
*/ @Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") @JsonDeserialize(as = ParcelImpl.class) public interface Parcel { /** * * @return id */ @NotNull @JsonProperty("id") public String getId(); /** * * @return createdAt */ @NotNull @JsonProperty("createdAt") public String getCreatedAt(); /** * * @return measurements */ @NotNull @Valid @JsonProperty("measurements") public ParcelMeasurements getMeasurements(); /** * * @return trackingData */ @NotNull @Valid @JsonProperty("trackingData") public TrackingData getTrackingData(); /** * * @return items */ @NotNull @Valid @JsonProperty("items") public List getItems(); /** * set id * @param id value to be set */ public void setId(final String id); /** * set createdAt * @param createdAt value to be set */ public void setCreatedAt(final String createdAt); /** * set measurements * @param measurements value to be set */ public void setMeasurements(final ParcelMeasurements measurements); /** * set trackingData * @param trackingData value to be set */ public void setTrackingData(final TrackingData trackingData); /** * set items * @param items values to be set */ @JsonIgnore public void setItems(final DeliveryItem... items); /** * set items * @param items values to be set */ public void setItems(final List items); /** * factory method * @return instance of Parcel */ public static Parcel of() { return new ParcelImpl(); } /** * factory method to create a shallow copy Parcel * @param template instance to be copied * @return copy instance */ public static Parcel of(final Parcel template) { ParcelImpl instance = new ParcelImpl(); instance.setId(template.getId()); instance.setCreatedAt(template.getCreatedAt()); instance.setMeasurements(template.getMeasurements()); instance.setTrackingData(template.getTrackingData()); instance.setItems(template.getItems()); return instance; } /** * factory method to create a deep copy of Parcel * @param template instance to be copied * @return copy instance */ @Nullable public static Parcel deepCopy(@Nullable final Parcel template) { if (template == null) { return null; } ParcelImpl instance = new ParcelImpl(); instance.setId(template.getId()); instance.setCreatedAt(template.getCreatedAt()); instance.setMeasurements( com.commercetools.history.models.common.ParcelMeasurements.deepCopy(template.getMeasurements())); instance.setTrackingData( com.commercetools.history.models.common.TrackingData.deepCopy(template.getTrackingData())); instance.setItems(Optional.ofNullable(template.getItems()) .map(t -> t.stream() .map(com.commercetools.history.models.common.DeliveryItem::deepCopy) .collect(Collectors.toList())) .orElse(null)); return instance; } /** * builder factory method for Parcel * @return builder */ public static ParcelBuilder builder() { return ParcelBuilder.of(); } /** * create builder for Parcel instance * @param template instance with prefilled values for the builder * @return builder */ public static ParcelBuilder builder(final Parcel template) { return ParcelBuilder.of(template); } /** * accessor map function * @param mapped type * @param helper function to map the object * @return mapped value */ default T withParcel(Function helper) { return helper.apply(this); } /** * gives a TypeReference for usage with Jackson DataBind * @return TypeReference */ public static com.fasterxml.jackson.core.type.TypeReference typeReference() { return new com.fasterxml.jackson.core.type.TypeReference() { @Override public String toString() { return "TypeReference"; } }; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy