
odata.msgraph.client.entity.WindowsPhone81CustomConfiguration Maven / Gradle / Ivy
package odata.msgraph.client.entity;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
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.ClientException;
import com.github.davidmoten.odata.client.CollectionPage;
import com.github.davidmoten.odata.client.HttpRequestOptions;
import com.github.davidmoten.odata.client.NameValue;
import com.github.davidmoten.odata.client.ODataEntityType;
import com.github.davidmoten.odata.client.RequestOptions;
import com.github.davidmoten.odata.client.UnmappedFields;
import com.github.davidmoten.odata.client.Util;
import com.github.davidmoten.odata.client.annotation.Property;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.UnmappedFieldsImpl;
import java.lang.Integer;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import odata.msgraph.client.complex.OmaSetting;
/**
* “This topic provides descriptions of the declared methods, properties and
* relationships exposed by the windowsPhone81CustomConfiguration resource.”
*/@JsonPropertyOrder({
"@odata.type",
"omaSettings"})
@JsonInclude(Include.NON_NULL)
public class WindowsPhone81CustomConfiguration extends DeviceConfiguration implements ODataEntityType {
@Override
public String odataTypeName() {
return "microsoft.graph.windowsPhone81CustomConfiguration";
}
@JsonProperty("omaSettings")
protected List omaSettings;
@JsonProperty("omaSettings@nextLink")
protected String omaSettingsNextLink;
protected WindowsPhone81CustomConfiguration() {
super();
}
/**
* Returns a builder which is used to create a new
* instance of this class (given that this class is immutable).
*
* @return a new Builder for this class
*/
// Suffix used on builder factory method to differentiate the method
// from static builder methods on superclasses
public static Builder builderWindowsPhone81CustomConfiguration() {
return new Builder();
}
public static final class Builder {
private String id;
private OffsetDateTime createdDateTime;
private String description;
private String displayName;
private OffsetDateTime lastModifiedDateTime;
private Integer version;
private List omaSettings;
private String omaSettingsNextLink;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
public Builder id(String id) {
this.id = id;
this.changedFields = changedFields.add("id");
return this;
}
public Builder createdDateTime(OffsetDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
this.changedFields = changedFields.add("createdDateTime");
return this;
}
public Builder description(String description) {
this.description = description;
this.changedFields = changedFields.add("description");
return this;
}
public Builder displayName(String displayName) {
this.displayName = displayName;
this.changedFields = changedFields.add("displayName");
return this;
}
public Builder lastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
this.lastModifiedDateTime = lastModifiedDateTime;
this.changedFields = changedFields.add("lastModifiedDateTime");
return this;
}
public Builder version(Integer version) {
this.version = version;
this.changedFields = changedFields.add("version");
return this;
}
/**
* “OMA settings. This collection can contain a maximum of 1000 elements.”
*
* @param omaSettings
* value of {@code omaSettings} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder omaSettings(List omaSettings) {
this.omaSettings = omaSettings;
this.changedFields = changedFields.add("omaSettings");
return this;
}
/**
* “OMA settings. This collection can contain a maximum of 1000 elements.”
*
* @param omaSettings
* value of {@code omaSettings} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder omaSettings(OmaSetting... omaSettings) {
return omaSettings(Arrays.asList(omaSettings));
}
/**
* “OMA settings. This collection can contain a maximum of 1000 elements.”
*
* @param omaSettingsNextLink
* value of {@code omaSettings@nextLink} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder omaSettingsNextLink(String omaSettingsNextLink) {
this.omaSettingsNextLink = omaSettingsNextLink;
this.changedFields = changedFields.add("omaSettings");
return this;
}
public WindowsPhone81CustomConfiguration build() {
WindowsPhone81CustomConfiguration _x = new WindowsPhone81CustomConfiguration();
_x.contextPath = null;
_x.changedFields = changedFields;
_x.unmappedFields = new UnmappedFieldsImpl();
_x.odataType = "microsoft.graph.windowsPhone81CustomConfiguration";
_x.id = id;
_x.createdDateTime = createdDateTime;
_x.description = description;
_x.displayName = displayName;
_x.lastModifiedDateTime = lastModifiedDateTime;
_x.version = version;
_x.omaSettings = omaSettings;
_x.omaSettingsNextLink = omaSettingsNextLink;
return _x;
}
}
@Override
@JsonIgnore
public ChangedFields getChangedFields() {
return changedFields;
}
@Override
public void postInject(boolean addKeysToContextPath) {
if (addKeysToContextPath && id != null) {
contextPath = contextPath.clearQueries().addKeys(new NameValue(id.toString()));
}
}
/**
* “OMA settings. This collection can contain a maximum of 1000 elements.”
*
* @return property omaSettings
*/
@Property(name="omaSettings")
@JsonIgnore
public CollectionPage getOmaSettings() {
return new CollectionPage(contextPath, OmaSetting.class, this.omaSettings, Optional.ofNullable(omaSettingsNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
}
/**
* Returns an immutable copy of {@code this} with just the {@code omaSettings}
* field changed. Field description below. The field name is also added to an
* internal map of changed fields in the returned object so that when {@code this.
* patch()} is called (if available)on the returned object only the changed fields
* are submitted.
*
* “OMA settings. This collection can contain a maximum of 1000 elements.”
*
* @param omaSettings
* new value of {@code omaSettings} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code omaSettings} field changed
*/
public WindowsPhone81CustomConfiguration withOmaSettings(List omaSettings) {
WindowsPhone81CustomConfiguration _x = _copy();
_x.changedFields = changedFields.add("omaSettings");
_x.odataType = Util.nvl(odataType, "microsoft.graph.windowsPhone81CustomConfiguration");
_x.omaSettings = omaSettings;
return _x;
}
/**
* “OMA settings. This collection can contain a maximum of 1000 elements.”
*
* @param options
* specify connect and read timeouts
* @return property omaSettings
*/
@Property(name="omaSettings")
@JsonIgnore
public CollectionPage getOmaSettings(HttpRequestOptions options) {
return new CollectionPage(contextPath, OmaSetting.class, this.omaSettings, Optional.ofNullable(omaSettingsNextLink), Collections.emptyList(), options);
}
public WindowsPhone81CustomConfiguration withUnmappedField(String name, String value) {
WindowsPhone81CustomConfiguration _x = _copy();
_x.setUnmappedField(name, value);
return _x;
}
@JsonAnySetter
private void setUnmappedField(String name, Object value) {
if (unmappedFields == null) {
unmappedFields = new UnmappedFieldsImpl();
}
unmappedFields.put(name, value);
}
@JsonAnyGetter
private UnmappedFieldsImpl unmappedFields() {
return unmappedFields == null ? UnmappedFieldsImpl.EMPTY : unmappedFields;
}
@Override
public UnmappedFields getUnmappedFields() {
return unmappedFields();
}
/**
* Submits only changed fields for update and returns an
* immutable copy of {@code this} with changed fields reset.
*
* @return a copy of {@code this} with changed fields reset
* @throws ClientException if HTTP response is not as expected
*/
public WindowsPhone81CustomConfiguration patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
WindowsPhone81CustomConfiguration _x = _copy();
_x.changedFields = null;
return _x;
}
/**
* Submits all fields for update and returns an immutable copy of {@code this}
* with changed fields reset (they were ignored anyway).
*
* @return a copy of {@code this} with changed fields reset
* @throws ClientException if HTTP response is not as expected
*/
public WindowsPhone81CustomConfiguration put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
WindowsPhone81CustomConfiguration _x = _copy();
_x.changedFields = null;
return _x;
}
private WindowsPhone81CustomConfiguration _copy() {
WindowsPhone81CustomConfiguration _x = new WindowsPhone81CustomConfiguration();
_x.contextPath = contextPath;
_x.changedFields = changedFields;
_x.unmappedFields = unmappedFields.copy();
_x.odataType = odataType;
_x.id = id;
_x.createdDateTime = createdDateTime;
_x.description = description;
_x.displayName = displayName;
_x.lastModifiedDateTime = lastModifiedDateTime;
_x.version = version;
_x.omaSettings = omaSettings;
return _x;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("WindowsPhone81CustomConfiguration[");
b.append("id=");
b.append(this.id);
b.append(", ");
b.append("createdDateTime=");
b.append(this.createdDateTime);
b.append(", ");
b.append("description=");
b.append(this.description);
b.append(", ");
b.append("displayName=");
b.append(this.displayName);
b.append(", ");
b.append("lastModifiedDateTime=");
b.append(this.lastModifiedDateTime);
b.append(", ");
b.append("version=");
b.append(this.version);
b.append(", ");
b.append("omaSettings=");
b.append(this.omaSettings);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}