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

odata.test.trip.pin.entity.Trip 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.CollectionPageEntityRequest;
import com.github.davidmoten.odata.client.CollectionPageNonEntity;
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.EdmSchemaInfo;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.UnmappedFields;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Optional;
import odata.test.trip.pin.entity.Photo;
import odata.test.trip.pin.entity.PlanItem;
import odata.test.trip.pin.entity.request.PhotoRequest;
import odata.test.trip.pin.entity.request.PlanItemRequest;
import odata.test.trip.pin.schema.SchemaInfo;

@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
    "@odata.type", 
    "TripId", 
    "ShareId", 
    "Description", 
    "Name", 
    "Budget", 
    "StartsAt", 
    "EndsAt", 
    "Tags"})
public class Trip implements ODataEntityType {

    @JacksonInject
    @JsonIgnore
    protected ContextPath contextPath;

    @JacksonInject
    @JsonIgnore
    protected UnmappedFields unmappedFields;

    @JacksonInject
    @JsonIgnore
    protected ChangedFields changedFields;

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

    @JsonProperty("TripId")
    protected Integer tripId;

    @JsonProperty("ShareId")
    protected String shareId;

    @JsonProperty("Description")
    protected String description;

    @JsonProperty("Name")
    protected String name;

    @JsonProperty("Budget")
    protected Float budget;

    @JsonProperty("StartsAt")
    protected OffsetDateTime startsAt;

    @JsonProperty("EndsAt")
    protected OffsetDateTime endsAt;

    @JsonProperty("Tags")
    protected List tags;

    @JsonProperty("Tags@nextLink")
    protected String tagsNextLink;

    protected Trip() {
    }

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

    public static final class Builder {
        private Integer tripId;
        private String shareId;
        private String description;
        private String name;
        private Float budget;
        private OffsetDateTime startsAt;
        private OffsetDateTime endsAt;
        private List tags;
        private String tagsNextLink;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

        public Builder tripId(Integer tripId) {
            this.tripId = tripId;
            this.changedFields = changedFields.add("TripId");
            return this;
        }

        public Builder shareId(String shareId) {
            this.shareId = shareId;
            this.changedFields = changedFields.add("ShareId");
            return this;
        }

        public Builder description(String description) {
            this.description = description;
            this.changedFields = changedFields.add("Description");
            return this;
        }

        public Builder name(String name) {
            this.name = name;
            this.changedFields = changedFields.add("Name");
            return this;
        }

        public Builder budget(Float budget) {
            this.budget = budget;
            this.changedFields = changedFields.add("Budget");
            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 tags(List tags) {
            this.tags = tags;
            this.changedFields = changedFields.add("Tags");
            return this;
        }

        public Builder tagsNextLink(String tagsNextLink) {
            this.tagsNextLink = tagsNextLink;
            this.changedFields = changedFields.add("Tags");
            return this;
        }

        public Trip build() {
            Trip _x = new Trip();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = UnmappedFields.EMPTY;
            _x.odataType = "Microsoft.OData.SampleService.Models.TripPin.Trip";
            _x.tripId = tripId;
            _x.shareId = shareId;
            _x.description = description;
            _x.name = name;
            _x.budget = budget;
            _x.startsAt = startsAt;
            _x.endsAt = endsAt;
            _x.tags = tags;
            _x.tagsNextLink = tagsNextLink;
            return _x;
        }
    }

    public ChangedFields getChangedFields() {
        return changedFields;
    }

    public Optional getTripId() {
        return Optional.ofNullable(tripId);
    }

    public Trip withTripId(Integer tripId) {
        Trip _x = _copy();
        _x.changedFields = changedFields.add("TripId");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Trip");
        _x.tripId = tripId;
        return _x;
    }

    public Optional getShareId() {
        return Optional.ofNullable(shareId);
    }

    public Trip withShareId(String shareId) {
        Trip _x = _copy();
        _x.changedFields = changedFields.add("ShareId");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Trip");
        _x.shareId = shareId;
        return _x;
    }

    public Optional getDescription() {
        return Optional.ofNullable(description);
    }

    public Trip withDescription(String description) {
        Trip _x = _copy();
        _x.changedFields = changedFields.add("Description");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Trip");
        _x.description = description;
        return _x;
    }

    public Optional getName() {
        return Optional.ofNullable(name);
    }

    public Trip withName(String name) {
        Trip _x = _copy();
        _x.changedFields = changedFields.add("Name");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Trip");
        _x.name = name;
        return _x;
    }

    public Optional getBudget() {
        return Optional.ofNullable(budget);
    }

    public Trip withBudget(Float budget) {
        Trip _x = _copy();
        _x.changedFields = changedFields.add("Budget");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Trip");
        _x.budget = budget;
        return _x;
    }

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

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

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

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

    public CollectionPageNonEntity getTags() {
        return new CollectionPageNonEntity(contextPath, String.class, tags, Optional.ofNullable(tagsNextLink), EdmSchemaInfo.INSTANCE);
    }

    public CollectionPageEntityRequest getPhotos() {
        return new CollectionPageEntityRequest(
                        contextPath.addSegment("Photos"),
                        Photo.class,
                        contextPath -> new PhotoRequest(contextPath), SchemaInfo.INSTANCE);
    }

    public CollectionPageEntityRequest getPlanItems() {
        return new CollectionPageEntityRequest(
                        contextPath.addSegment("PlanItems"),
                        PlanItem.class,
                        contextPath -> new PlanItemRequest(contextPath), SchemaInfo.INSTANCE);
    }

    @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 Trip patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        Trip _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    public Trip put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        Trip _x = _copy();
        _x.changedFields = null;
        return _x;
    }
    private Trip _copy() {
        Trip _x = new Trip();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields;
        _x.odataType = odataType;
        _x.tripId = tripId;
        _x.shareId = shareId;
        _x.description = description;
        _x.name = name;
        _x.budget = budget;
        _x.startsAt = startsAt;
        _x.endsAt = endsAt;
        _x.tags = tags;
        _x.tagsNextLink = tagsNextLink;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("Trip[");
        b.append("TripId=");
        b.append(this.tripId);
        b.append(", ");
        b.append("ShareId=");
        b.append(this.shareId);
        b.append(", ");
        b.append("Description=");
        b.append(this.description);
        b.append(", ");
        b.append("Name=");
        b.append(this.name);
        b.append(", ");
        b.append("Budget=");
        b.append(this.budget);
        b.append(", ");
        b.append("StartsAt=");
        b.append(this.startsAt);
        b.append(", ");
        b.append("EndsAt=");
        b.append(this.endsAt);
        b.append(", ");
        b.append("Tags=");
        b.append(this.tags);
        b.append(", ");
        b.append("Tags=");
        b.append(this.tagsNextLink);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy