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

io.sphere.sdk.orders.TrackingData Maven / Gradle / Ivy

There is a newer version: 1.0.0-M12
Show newest version
package io.sphere.sdk.orders;

import io.sphere.sdk.models.Base;

import java.util.Optional;

public class TrackingData extends Base {
    private final Optional trackingId;
    private final Optional carrier;
    private final Optional provider;
    private final Optional providerTransaction;
    private final boolean isReturn;

    private TrackingData(final Optional trackingId, final Optional carrier, final Optional provider, final Optional providerTransaction, final boolean isReturn) {
        this.trackingId = trackingId;
        this.carrier = carrier;
        this.provider = provider;
        this.providerTransaction = providerTransaction;
        this.isReturn = isReturn;
    }

    public static TrackingData of() {
        return of(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), false);
    }

    public static TrackingData of(final Optional trackingId, final Optional carrier, final Optional provider, final Optional providerTransaction, final boolean isReturn) {
        return new TrackingData(trackingId, carrier, provider, providerTransaction, isReturn);
    }

    public Optional getTrackingId() {
        return trackingId;
    }

    public Optional getCarrier() {
        return carrier;
    }

    public Optional getProvider() {
        return provider;
    }

    public Optional getProviderTransaction() {
        return providerTransaction;
    }

    public boolean isReturn() {
        return isReturn;
    }

    public TrackingData withTrackingId(final String trackingId) {
        return newBuilder().trackingId(trackingId).build();
    }

    public TrackingData withCarrier(final String carrier) {
        return newBuilder().carrier(carrier).build();
    }

    public TrackingData withProvider(final String provider) {
        return newBuilder().provider(provider).build();
    }

    public TrackingData withProviderTransaction(final String providerTransaction) {
        return newBuilder().providerTransaction(providerTransaction).build();
    }

    public TrackingData withIsReturn(final boolean isReturn) {
        return newBuilder().isReturn(isReturn).build();
    }

    private TrackingDataBuilder newBuilder() {
        return TrackingDataBuilder.of(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy