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

odata.test.trip.pin.entity.PlanItem Maven / Gradle / Ivy

There is a newer version: 0.1.13
Show newest version
package odata.test.trip.pin.entity;

import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.github.davidmoten.odata.client.ContextPath;
import com.github.davidmoten.odata.client.ODataEntityType;
import com.github.davidmoten.odata.client.RequestOptions;
import com.github.davidmoten.odata.client.Util;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.UnmappedFields;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Optional;
import odata.test.trip.pin.schema.SchemaInfo;

@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
    "@odata.type", 
    "PlanItemId", 
    "ConfirmationCode", 
    "StartsAt", 
    "EndsAt", 
    "Duration"})
public class PlanItem implements ODataEntityType {

    @JacksonInject
    @JsonIgnore
    protected ContextPath contextPath;

    @JacksonInject
    @JsonIgnore
    protected UnmappedFields unmappedFields;

    @JacksonInject
    @JsonIgnore
    protected ChangedFields changedFields;

    @JsonProperty("@odata.type")
    protected String odataType;

    @JsonProperty("PlanItemId")
    protected Integer planItemId;

    @JsonProperty("ConfirmationCode")
    protected String confirmationCode;

    @JsonProperty("StartsAt")
    protected OffsetDateTime startsAt;

    @JsonProperty("EndsAt")
    protected OffsetDateTime endsAt;

    @JsonProperty("Duration")
    protected Duration duration;

    protected PlanItem() {
    }

    public static Builder builder() {
        return new Builder();
    }

    public static final class Builder {
        private Integer planItemId;
        private String confirmationCode;
        private OffsetDateTime startsAt;
        private OffsetDateTime endsAt;
        private Duration duration;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

        public Builder planItemId(Integer planItemId) {
            this.planItemId = planItemId;
            this.changedFields = changedFields.add("PlanItemId");
            return this;
        }

        public Builder confirmationCode(String confirmationCode) {
            this.confirmationCode = confirmationCode;
            this.changedFields = changedFields.add("ConfirmationCode");
            return this;
        }

        public Builder startsAt(OffsetDateTime startsAt) {
            this.startsAt = startsAt;
            this.changedFields = changedFields.add("StartsAt");
            return this;
        }

        public Builder endsAt(OffsetDateTime endsAt) {
            this.endsAt = endsAt;
            this.changedFields = changedFields.add("EndsAt");
            return this;
        }

        public Builder duration(Duration duration) {
            this.duration = duration;
            this.changedFields = changedFields.add("Duration");
            return this;
        }

        public PlanItem build() {
            PlanItem _x = new PlanItem();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = UnmappedFields.EMPTY;
            _x.odataType = "Microsoft.OData.SampleService.Models.TripPin.PlanItem";
            _x.planItemId = planItemId;
            _x.confirmationCode = confirmationCode;
            _x.startsAt = startsAt;
            _x.endsAt = endsAt;
            _x.duration = duration;
            return _x;
        }
    }

    public ChangedFields getChangedFields() {
        return changedFields;
    }

    public Optional getPlanItemId() {
        return Optional.ofNullable(planItemId);
    }

    public PlanItem withPlanItemId(Integer planItemId) {
        PlanItem _x = _copy();
        _x.changedFields = changedFields.add("PlanItemId");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.PlanItem");
        _x.planItemId = planItemId;
        return _x;
    }

    public Optional getConfirmationCode() {
        return Optional.ofNullable(confirmationCode);
    }

    public PlanItem withConfirmationCode(String confirmationCode) {
        PlanItem _x = _copy();
        _x.changedFields = changedFields.add("ConfirmationCode");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.PlanItem");
        _x.confirmationCode = confirmationCode;
        return _x;
    }

    public Optional getStartsAt() {
        return Optional.ofNullable(startsAt);
    }

    public PlanItem withStartsAt(OffsetDateTime startsAt) {
        PlanItem _x = _copy();
        _x.changedFields = changedFields.add("StartsAt");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.PlanItem");
        _x.startsAt = startsAt;
        return _x;
    }

    public Optional getEndsAt() {
        return Optional.ofNullable(endsAt);
    }

    public PlanItem withEndsAt(OffsetDateTime endsAt) {
        PlanItem _x = _copy();
        _x.changedFields = changedFields.add("EndsAt");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.PlanItem");
        _x.endsAt = endsAt;
        return _x;
    }

    public Optional getDuration() {
        return Optional.ofNullable(duration);
    }

    public PlanItem withDuration(Duration duration) {
        PlanItem _x = _copy();
        _x.changedFields = changedFields.add("Duration");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.PlanItem");
        _x.duration = duration;
        return _x;
    }

    @JsonAnySetter
    private void setUnmappedField(String name, Object value) {
        if (unmappedFields == null) {
            unmappedFields = new UnmappedFields();
        }
        unmappedFields.put(name, value);
    }

    @Override
    public UnmappedFields getUnmappedFields() {
        return unmappedFields == null ? UnmappedFields.EMPTY : unmappedFields;
    }

    public PlanItem patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        PlanItem _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    public PlanItem put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        PlanItem _x = _copy();
        _x.changedFields = null;
        return _x;
    }
    private PlanItem _copy() {
        PlanItem _x = new PlanItem();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields;
        _x.odataType = odataType;
        _x.planItemId = planItemId;
        _x.confirmationCode = confirmationCode;
        _x.startsAt = startsAt;
        _x.endsAt = endsAt;
        _x.duration = duration;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("PlanItem[");
        b.append("PlanItemId=");
        b.append(this.planItemId);
        b.append(", ");
        b.append("ConfirmationCode=");
        b.append(this.confirmationCode);
        b.append(", ");
        b.append("StartsAt=");
        b.append(this.startsAt);
        b.append(", ");
        b.append("EndsAt=");
        b.append(this.endsAt);
        b.append(", ");
        b.append("Duration=");
        b.append(this.duration);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy