odata.test.trip.pin.complex.Location Maven / Gradle / Ivy
package odata.test.trip.pin.complex;
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.ODataType;
import com.github.davidmoten.odata.client.Util;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.UnmappedFields;
import java.util.Optional;
import odata.test.trip.pin.complex.City;
@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
"@odata.type",
"Address",
"City"})
public class Location implements ODataType {
protected ContextPath contextPath;
@JacksonInject
@JsonIgnore
protected UnmappedFields unmappedFields;
@JsonProperty("@odata.type")
protected String odataType;
@JsonProperty("Address")
protected String address;
@JsonProperty("City")
protected City city;
protected Location() {
}
public Optional getAddress() {
return Optional.ofNullable(address);
}
public Location withAddress(String address) {
Location _x = _copy();
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Location");
_x.address = address;
return _x;
}
public Optional getCity() {
return Optional.ofNullable(city);
}
public Location withCity(City city) {
Location _x = _copy();
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Location");
_x.city = city;
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 static Builder builder() {
return new Builder();
}
public static final class Builder {
private String address;
private City city;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
public Builder address(String address) {
this.address = address;
this.changedFields = changedFields.add("Address");
return this;
}
public Builder city(City city) {
this.city = city;
this.changedFields = changedFields.add("City");
return this;
}
public Location build() {
Location _x = new Location();
_x.contextPath = null;
_x.unmappedFields = UnmappedFields.EMPTY;
_x.odataType = "Microsoft.OData.SampleService.Models.TripPin.Location";
_x.address = address;
_x.city = city;
return _x;
}
}
private Location _copy() {
Location _x = new Location();
_x.contextPath = contextPath;
_x.unmappedFields = unmappedFields;
_x.odataType = odataType;
_x.address = address;
_x.city = city;
return _x;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("Location[");
b.append("Address=");
b.append(this.address);
b.append(", ");
b.append("City=");
b.append(this.city);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy