All Downloads are FREE. Search and download functionalities are using the official Maven repository.

odata.test.trip.pin.entity.Photo Maven / Gradle / Ivy

There is a newer version: 0.1.13
Show newest version
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.StreamProvider;
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.schema.SchemaInfo;

@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
    "@odata.type", 
    "Id", 
    "Name"})
public class Photo implements ODataEntityType {

    @JacksonInject
    @JsonIgnore
    protected ContextPath contextPath;

    @JacksonInject
    @JsonIgnore
    protected UnmappedFields unmappedFields;

    @JacksonInject
    @JsonIgnore
    protected ChangedFields changedFields;

    @JsonProperty("@odata.type")
    protected String odataType;

    @JsonProperty("Id")
    protected Long id;

    @JsonProperty("Name")
    protected String name;

    protected Photo() {
    }

    public static Builder builder() {
        return new Builder();
    }

    public static final class Builder {
        private Long id;
        private String name;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

        public Builder id(Long id) {
            this.id = id;
            this.changedFields = changedFields.add("Id");
            return this;
        }

        public Builder name(String name) {
            this.name = name;
            this.changedFields = changedFields.add("Name");
            return this;
        }

        public Photo build() {
            Photo _x = new Photo();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = UnmappedFields.EMPTY;
            _x.odataType = "Microsoft.OData.SampleService.Models.TripPin.Photo";
            _x.id = id;
            _x.name = name;
            return _x;
        }
    }

    public ChangedFields getChangedFields() {
        return changedFields;
    }

    public Optional getId() {
        return Optional.ofNullable(id);
    }

    public Photo withId(Long id) {
        Photo _x = _copy();
        _x.changedFields = changedFields.add("Id");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Photo");
        _x.id = id;
        return _x;
    }

    public Optional getName() {
        return Optional.ofNullable(name);
    }

    public Photo withName(String name) {
        Photo _x = _copy();
        _x.changedFields = changedFields.add("Name");
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.Photo");
        _x.name = name;
        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 Optional getStream() {
        return RequestHelper.createStream(contextPath, this);
    }

    public Photo patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        Photo _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    public Photo put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY,  SchemaInfo.INSTANCE);
        Photo _x = _copy();
        _x.changedFields = null;
        return _x;
    }
    private Photo _copy() {
        Photo _x = new Photo();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields;
        _x.odataType = odataType;
        _x.id = id;
        _x.name = name;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("Photo[");
        b.append("Id=");
        b.append(this.id);
        b.append(", ");
        b.append("Name=");
        b.append(this.name);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy