odata.test.trip.pin.entity.Person 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.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.util.List;
import java.util.Optional;
import odata.test.trip.pin.complex.Location;
import odata.test.trip.pin.entity.Trip;
import odata.test.trip.pin.entity.request.PersonRequest;
import odata.test.trip.pin.entity.request.PhotoRequest;
import odata.test.trip.pin.entity.request.TripRequest;
import odata.test.trip.pin.enums.PersonGender;
import odata.test.trip.pin.schema.SchemaInfo;
@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
"@odata.type",
"UserName",
"FirstName",
"LastName",
"Emails",
"AddressInfo",
"Gender",
"Concurrency"})
public class Person implements ODataEntityType {
@JacksonInject
@JsonIgnore
protected ContextPath contextPath;
@JacksonInject
@JsonIgnore
protected UnmappedFields unmappedFields;
@JacksonInject
@JsonIgnore
protected ChangedFields changedFields;
@JsonProperty("@odata.type")
protected String odataType;
@JsonProperty("UserName")
protected String userName;
@JsonProperty("FirstName")
protected String firstName;
@JsonProperty("LastName")
protected String lastName;
@JsonProperty("Emails")
protected List emails;
@JsonProperty("Emails@nextLink")
protected String emailsNextLink;
@JsonProperty("AddressInfo")
protected List addressInfo;
@JsonProperty("AddressInfo@nextLink")
protected String addressInfoNextLink;
@JsonProperty("Gender")
protected PersonGender gender;
@JsonProperty("Concurrency")
protected Long concurrency;
protected Person() {
}
public static Builder builder() {
return new Builder();
}
public static final class Builder {
private String userName;
private String firstName;
private String lastName;
private List emails;
private String emailsNextLink;
private List addressInfo;
private String addressInfoNextLink;
private PersonGender gender;
private Long concurrency;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
public Builder userName(String userName) {
this.userName = userName;
this.changedFields = changedFields.add("UserName");
return this;
}
public Builder firstName(String firstName) {
this.firstName = firstName;
this.changedFields = changedFields.add("FirstName");
return this;
}
public Builder lastName(String lastName) {
this.lastName = lastName;
this.changedFields = changedFields.add("LastName");
return this;
}
public Builder emails(List emails) {
this.emails = emails;
this.changedFields = changedFields.add("Emails");
return this;
}
public Builder emailsNextLink(String emailsNextLink) {
this.emailsNextLink = emailsNextLink;
this.changedFields = changedFields.add("Emails");
return this;
}
public Builder addressInfo(List addressInfo) {
this.addressInfo = addressInfo;
this.changedFields = changedFields.add("AddressInfo");
return this;
}
public Builder addressInfoNextLink(String addressInfoNextLink) {
this.addressInfoNextLink = addressInfoNextLink;
this.changedFields = changedFields.add("AddressInfo");
return this;
}
public Builder gender(PersonGender gender) {
this.gender = gender;
this.changedFields = changedFields.add("Gender");
return this;
}
public Builder concurrency(Long concurrency) {
this.concurrency = concurrency;
this.changedFields = changedFields.add("Concurrency");
return this;
}
public Person build() {
Person _x = new Person();
_x.contextPath = null;
_x.changedFields = changedFields;
_x.unmappedFields = UnmappedFields.EMPTY;
_x.odataType = "Microsoft.OData.SampleService.Models.TripPin.Person";
_x.userName = userName;
_x.firstName = firstName;
_x.lastName = lastName;
_x.emails = emails;
_x.emailsNextLink = emailsNextLink;
_x.addressInfo = addressInfo;
_x.addressInfoNextLink = addressInfoNextLink;
_x.gender = gender;
_x.concurrency = concurrency;
return _x;
}
}
public ChangedFields getChangedFields() {
return changedFields;
}
public Optional getUserName() {
return Optional.ofNullable(userName);
}
public Person withUserName(String userName) {
Person _x = _copy();
_x.changedFields = changedFields.add("UserName");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Person");
_x.userName = userName;
return _x;
}
public Optional getFirstName() {
return Optional.ofNullable(firstName);
}
public Person withFirstName(String firstName) {
Person _x = _copy();
_x.changedFields = changedFields.add("FirstName");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Person");
_x.firstName = firstName;
return _x;
}
public Optional getLastName() {
return Optional.ofNullable(lastName);
}
public Person withLastName(String lastName) {
Person _x = _copy();
_x.changedFields = changedFields.add("LastName");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Person");
_x.lastName = lastName;
return _x;
}
public CollectionPageNonEntity getEmails() {
return new CollectionPageNonEntity(contextPath, String.class, emails, Optional.ofNullable(emailsNextLink), EdmSchemaInfo.INSTANCE);
}
public CollectionPageNonEntity getAddressInfo() {
return new CollectionPageNonEntity(contextPath, Location.class, addressInfo, Optional.ofNullable(addressInfoNextLink), SchemaInfo.INSTANCE);
}
public Optional getGender() {
return Optional.ofNullable(gender);
}
public Person withGender(PersonGender gender) {
Person _x = _copy();
_x.changedFields = changedFields.add("Gender");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Person");
_x.gender = gender;
return _x;
}
public Optional getConcurrency() {
return Optional.ofNullable(concurrency);
}
public Person withConcurrency(Long concurrency) {
Person _x = _copy();
_x.changedFields = changedFields.add("Concurrency");
_x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Person");
_x.concurrency = concurrency;
return _x;
}
public CollectionPageEntityRequest getFriends() {
return new CollectionPageEntityRequest(
contextPath.addSegment("Friends"),
odata.test.trip.pin.entity.Person.class,
contextPath -> new PersonRequest(contextPath), SchemaInfo.INSTANCE);
}
public CollectionPageEntityRequest getTrips() {
return new CollectionPageEntityRequest(
contextPath.addSegment("Trips"),
Trip.class,
contextPath -> new TripRequest(contextPath), SchemaInfo.INSTANCE);
}
public PhotoRequest getPhoto() {
return new PhotoRequest(contextPath.addSegment("Photo"));
}
@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 Person patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY, SchemaInfo.INSTANCE);
Person _x = _copy();
_x.changedFields = null;
return _x;
}
public Person put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY, SchemaInfo.INSTANCE);
Person _x = _copy();
_x.changedFields = null;
return _x;
}
private Person _copy() {
Person _x = new Person();
_x.contextPath = contextPath;
_x.changedFields = changedFields;
_x.unmappedFields = unmappedFields;
_x.odataType = odataType;
_x.userName = userName;
_x.firstName = firstName;
_x.lastName = lastName;
_x.emails = emails;
_x.emailsNextLink = emailsNextLink;
_x.addressInfo = addressInfo;
_x.addressInfoNextLink = addressInfoNextLink;
_x.gender = gender;
_x.concurrency = concurrency;
return _x;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("Person[");
b.append("UserName=");
b.append(this.userName);
b.append(", ");
b.append("FirstName=");
b.append(this.firstName);
b.append(", ");
b.append("LastName=");
b.append(this.lastName);
b.append(", ");
b.append("Emails=");
b.append(this.emails);
b.append(", ");
b.append("Emails=");
b.append(this.emailsNextLink);
b.append(", ");
b.append("AddressInfo=");
b.append(this.addressInfo);
b.append(", ");
b.append("AddressInfo=");
b.append(this.addressInfoNextLink);
b.append(", ");
b.append("Gender=");
b.append(this.gender);
b.append(", ");
b.append("Concurrency=");
b.append(this.concurrency);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy