odata.test.trip.pin.entity.Airport Maven / Gradle / Ivy
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.complex.AirportLocation;
import odata.test.trip.pin.schema.SchemaInfo;
@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
"@odata.type",
"IcaoCode",
"Name",
"IataCode",
"Location"})
public class Airport implements ODataEntityType {
@JacksonInject
@JsonIgnore
protected ContextPath contextPath;
@JacksonInject
@JsonIgnore
protected UnmappedFields unmappedFields;
@JacksonInject
@JsonIgnore
protected ChangedFields changedFields;
@JsonProperty("@odata.type")
protected String odataType;
@JsonProperty("IcaoCode")
protected String icaoCode;
@JsonProperty("Name")
protected String name;
@JsonProperty("IataCode")
protected String iataCode;
@JsonProperty("Location")
protected AirportLocation location;
protected Airport() {
}
public static Builder builder() {
return new Builder();
}
public static final class Builder {
private String icaoCode;
private String name;
private String iataCode;
private AirportLocation location;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
public Builder icaoCode(String icaoCode) {
this.icaoCode = icaoCode;
this.changedFields = changedFields.add("IcaoCode");
return this;
}
public Builder name(String name) {
this.name = name;
this.changedFields = changedFields.add("Name");
return this;
}
public Builder iataCode(String iataCode) {
this.iataCode = iataCode;
this.changedFields = changedFields.add("IataCode");
return this;
}
public Builder location(AirportLocation location) {
this.location = location;
this.changedFields = changedFields.add("Location");
return this;
}
public Airport build() {
Airport _x = new Airport();
_x.contextPath = null;
_x.changedFields = changedFields;
_x.unmappedFields = UnmappedFields.EMPTY;
_x.odataType = "Microsoft.OData.SampleService.Models.TripPin.Airport";
_x.icaoCode = icaoCode;
_x.name = name;
_x.iataCode = iataCode;
_x.location = location;
return _x;
}
}
public ChangedFields getChangedFields() {
return changedFields;
}
public Optional getIcaoCode() {
return Optional.ofNullable(icaoCode);
}
public Airport withIcaoCode(String icaoCode) {
Airport _x = _copy();
_x.changedFields = changedFields.add("IcaoCode");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Airport");
_x.icaoCode = icaoCode;
return _x;
}
public Optional getName() {
return Optional.ofNullable(name);
}
public Airport withName(String name) {
Airport _x = _copy();
_x.changedFields = changedFields.add("Name");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Airport");
_x.name = name;
return _x;
}
public Optional getIataCode() {
return Optional.ofNullable(iataCode);
}
public Airport withIataCode(String iataCode) {
Airport _x = _copy();
_x.changedFields = changedFields.add("IataCode");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Airport");
_x.iataCode = iataCode;
return _x;
}
public Optional getLocation() {
return Optional.ofNullable(location);
}
public Airport withLocation(AirportLocation location) {
Airport _x = _copy();
_x.changedFields = changedFields.add("Location");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Airport");
_x.location = location;
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 Airport patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY, SchemaInfo.INSTANCE);
Airport _x = _copy();
_x.changedFields = null;
return _x;
}
public Airport put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY, SchemaInfo.INSTANCE);
Airport _x = _copy();
_x.changedFields = null;
return _x;
}
private Airport _copy() {
Airport _x = new Airport();
_x.contextPath = contextPath;
_x.changedFields = changedFields;
_x.unmappedFields = unmappedFields;
_x.odataType = odataType;
_x.icaoCode = icaoCode;
_x.name = name;
_x.iataCode = iataCode;
_x.location = location;
return _x;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("Airport[");
b.append("IcaoCode=");
b.append(this.icaoCode);
b.append(", ");
b.append("Name=");
b.append(this.name);
b.append(", ");
b.append("IataCode=");
b.append(this.iataCode);
b.append(", ");
b.append("Location=");
b.append(this.location);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy