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

odata.test.trip.pin.complex.City Maven / Gradle / Ivy

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

@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({
    "@odata.type", 
    "CountryRegion", 
    "Name", 
    "Region"})
public class City implements ODataType {

    protected ContextPath contextPath;

    @JacksonInject
    @JsonIgnore
    protected UnmappedFields unmappedFields;

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

    @JsonProperty("CountryRegion")
    protected String countryRegion;

    @JsonProperty("Name")
    protected String name;

    @JsonProperty("Region")
    protected String region;

    protected City() {
    }

    public Optional getCountryRegion() {
        return Optional.ofNullable(countryRegion);
    }

    public City withCountryRegion(String countryRegion) {
        City _x = _copy();
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.City");
        _x.countryRegion = countryRegion;
        return _x;
    }

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

    public City withName(String name) {
        City _x = _copy();
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.City");
        _x.name = name;
        return _x;
    }

    public Optional getRegion() {
        return Optional.ofNullable(region);
    }

    public City withRegion(String region) {
        City _x = _copy();
        _x.odataType = Util.nvl(odataType, "Microsoft.OData.SampleService.Models.TripPin.City");
        _x.region = region;
        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 countryRegion;
        private String name;
        private String region;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

        public Builder countryRegion(String countryRegion) {
            this.countryRegion = countryRegion;
            this.changedFields = changedFields.add("CountryRegion");
            return this;
        }

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

        public Builder region(String region) {
            this.region = region;
            this.changedFields = changedFields.add("Region");
            return this;
        }

        public City build() {
            City _x = new City();
            _x.contextPath = null;
            _x.unmappedFields = UnmappedFields.EMPTY;
            _x.odataType = "Microsoft.OData.SampleService.Models.TripPin.City";
            _x.countryRegion = countryRegion;
            _x.name = name;
            _x.region = region;
            return _x;
        }
    }
    private City _copy() {
        City _x = new City();
        _x.contextPath = contextPath;
        _x.unmappedFields = unmappedFields;
        _x.odataType = odataType;
        _x.countryRegion = countryRegion;
        _x.name = name;
        _x.region = region;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("City[");
        b.append("CountryRegion=");
        b.append(this.countryRegion);
        b.append(", ");
        b.append("Name=");
        b.append(this.name);
        b.append(", ");
        b.append("Region=");
        b.append(this.region);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy