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

odata.test.trip.pin.entity.Event 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.JsonAnySetter;
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.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.complex.EventLocation;
import odata.test.trip.pin.entity.PlanItem;
import odata.test.trip.pin.schema.SchemaInfo;

@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
    "@odata.type", 
    "Description", 
    "OccursAt"})
public class Event extends PlanItem implements ODataEntityType {

    @JsonProperty("Description")
    protected String description;

    @JsonProperty("OccursAt")
    protected EventLocation occursAt;

    protected Event() {
        super();
    }

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

    public static final class Builder {
        private Integer planItemId;
        private String confirmationCode;
        private OffsetDateTime startsAt;
        private OffsetDateTime endsAt;
        private Duration duration;
        private String description;
        private EventLocation occursAt;
        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 Builder description(String description) {
            this.description = description;
            this.changedFields = changedFields.add("Description");
            return this;
        }

        public Builder occursAt(EventLocation occursAt) {
            this.occursAt = occursAt;
            this.changedFields = changedFields.add("OccursAt");
            return this;
        }

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

    public ChangedFields getChangedFields() {
        return changedFields;
    }

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

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

    public Optional getOccursAt() {
        return Optional.ofNullable(occursAt);
    }

    public Event withOccursAt(EventLocation occursAt) {
        Event _x = _copy();
        _x.changedFields = changedFields.add("OccursAt");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Event");
        _x.occursAt = occursAt;
        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 Event patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        Event _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    public Event put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        Event _x = _copy();
        _x.changedFields = null;
        return _x;
    }
    private Event _copy() {
        Event _x = new Event();
        _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;
        _x.description = description;
        _x.occursAt = occursAt;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("Event[");
        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("Description=");
        b.append(this.description);
        b.append(", ");
        b.append("OccursAt=");
        b.append(this.occursAt);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy