odata.msgraph.client.complex.BookingWorkHours Maven / Gradle / Ivy
Show all versions of odata-client-msgraph Show documentation
package odata.msgraph.client.complex;
import com.fasterxml.jackson.annotation.JacksonInject;
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.CollectionPage;
import com.github.davidmoten.odata.client.ContextPath;
import com.github.davidmoten.odata.client.HttpRequestOptions;
import com.github.davidmoten.odata.client.ODataType;
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.UnmappedFieldsImpl;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import odata.msgraph.client.enums.DayOfWeek;
/**
* “This type represents the set of working hours in a single day of the week.”
*/@JsonPropertyOrder({
"@odata.type",
"day",
"timeSlots"})
@JsonInclude(Include.NON_NULL)
public class BookingWorkHours implements ODataType {
@JacksonInject
@JsonIgnore
protected ContextPath contextPath;
@JacksonInject
@JsonIgnore
protected UnmappedFieldsImpl unmappedFields;
@JsonProperty("@odata.type")
protected String odataType;
@JsonProperty("day")
protected DayOfWeek day;
@JsonProperty("timeSlots")
protected List timeSlots;
@JsonProperty("timeSlots@nextLink")
protected String timeSlotsNextLink;
protected BookingWorkHours() {
}
@Override
public String odataTypeName() {
return "microsoft.graph.bookingWorkHours";
}
/**
* “The day of the week represented by this instance.”
*
* @return property day
*/
@Property(name="day")
@JsonIgnore
public Optional getDay() {
return Optional.ofNullable(day);
}
/**
* Returns an immutable copy of {@code this} with just the {@code day} 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.
*
* “The day of the week represented by this instance.”
*
* @param day
* new value of {@code day} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code day} field changed
*/
public BookingWorkHours withDay(DayOfWeek day) {
BookingWorkHours _x = _copy();
_x.odataType = Util.nvl(odataType, "microsoft.graph.bookingWorkHours");
_x.day = day;
return _x;
}
/**
* “A list of start/end times during a day.”
*
* @return property timeSlots
*/
@Property(name="timeSlots")
@JsonIgnore
public CollectionPage getTimeSlots() {
return new CollectionPage(contextPath, BookingWorkTimeSlot.class, this.timeSlots, Optional.ofNullable(timeSlotsNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
}
/**
* “A list of start/end times during a day.”
*
* @param options
* specify connect and read timeouts
* @return property timeSlots
*/
@Property(name="timeSlots")
@JsonIgnore
public CollectionPage getTimeSlots(HttpRequestOptions options) {
return new CollectionPage(contextPath, BookingWorkTimeSlot.class, this.timeSlots, Optional.ofNullable(timeSlotsNextLink), Collections.emptyList(), options);
}
public BookingWorkHours withUnmappedField(String name, Object value) {
BookingWorkHours _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();
}
@Override
public void postInject(boolean addKeysToContextPath) {
// do nothing;
}
/**
* 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 builder() {
return new Builder();
}
public static final class Builder {
private DayOfWeek day;
private List timeSlots;
private String timeSlotsNextLink;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
/**
* “The day of the week represented by this instance.”
*
* @param day
* value of {@code day} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder day(DayOfWeek day) {
this.day = day;
this.changedFields = changedFields.add("day");
return this;
}
/**
* “A list of start/end times during a day.”
*
* @param timeSlots
* value of {@code timeSlots} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder timeSlots(List timeSlots) {
this.timeSlots = timeSlots;
this.changedFields = changedFields.add("timeSlots");
return this;
}
/**
* “A list of start/end times during a day.”
*
* @param timeSlots
* value of {@code timeSlots} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder timeSlots(BookingWorkTimeSlot... timeSlots) {
return timeSlots(Arrays.asList(timeSlots));
}
/**
* “A list of start/end times during a day.”
*
* @param timeSlotsNextLink
* value of {@code timeSlots@nextLink} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder timeSlotsNextLink(String timeSlotsNextLink) {
this.timeSlotsNextLink = timeSlotsNextLink;
this.changedFields = changedFields.add("timeSlots");
return this;
}
public BookingWorkHours build() {
BookingWorkHours _x = new BookingWorkHours();
_x.contextPath = null;
_x.unmappedFields = new UnmappedFieldsImpl();
_x.odataType = "microsoft.graph.bookingWorkHours";
_x.day = day;
_x.timeSlots = timeSlots;
_x.timeSlotsNextLink = timeSlotsNextLink;
return _x;
}
}
private BookingWorkHours _copy() {
BookingWorkHours _x = new BookingWorkHours();
_x.contextPath = contextPath;
_x.unmappedFields = unmappedFields.copy();
_x.odataType = odataType;
_x.day = day;
_x.timeSlots = timeSlots;
return _x;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("BookingWorkHours[");
b.append("day=");
b.append(this.day);
b.append(", ");
b.append("timeSlots=");
b.append(this.timeSlots);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}