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

odata.test.trip.pin.entity.Airline 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.util.Optional;
import odata.test.trip.pin.schema.SchemaInfo;

@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
    "@odata.type", 
    "AirlineCode", 
    "Name"})
public class Airline implements ODataEntityType {

    @JacksonInject
    @JsonIgnore
    protected ContextPath contextPath;

    @JacksonInject
    @JsonIgnore
    protected UnmappedFields unmappedFields;

    @JacksonInject
    @JsonIgnore
    protected ChangedFields changedFields;

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

    @JsonProperty("AirlineCode")
    protected String airlineCode;

    @JsonProperty("Name")
    protected String name;

    protected Airline() {
    }

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

    public static final class Builder {
        private String airlineCode;
        private String name;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

        public Builder airlineCode(String airlineCode) {
            this.airlineCode = airlineCode;
            this.changedFields = changedFields.add("AirlineCode");
            return this;
        }

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

        public Airline build() {
            Airline _x = new Airline();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = UnmappedFields.EMPTY;
            _x.odataType = "Microsoft.OData.SampleService.Models.TripPin.Airline";
            _x.airlineCode = airlineCode;
            _x.name = name;
            return _x;
        }
    }

    public ChangedFields getChangedFields() {
        return changedFields;
    }

    public Optional getAirlineCode() {
        return Optional.ofNullable(airlineCode);
    }

    public Airline withAirlineCode(String airlineCode) {
        Airline _x = _copy();
        _x.changedFields = changedFields.add("AirlineCode");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Airline");
        _x.airlineCode = airlineCode;
        return _x;
    }

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

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

    public Airline put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        Airline _x = _copy();
        _x.changedFields = null;
        return _x;
    }
    private Airline _copy() {
        Airline _x = new Airline();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields;
        _x.odataType = odataType;
        _x.airlineCode = airlineCode;
        _x.name = name;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("Airline[");
        b.append("AirlineCode=");
        b.append(this.airlineCode);
        b.append(", ");
        b.append("Name=");
        b.append(this.name);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy