BuyerDTO.java

package com.tradecloud.dto.api.buyer;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonRootName;

import javax.persistence.Access;
import javax.persistence.AccessType;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by ds on 2017/12/21.
 */
@Access(AccessType.FIELD)
@JsonRootName(value = "buyerDTO")
public class BuyerDTO {

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The buyer's first name.")
    private String firstName;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The buyer's surname.")
    private String lastName;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The email address for this buyer.")
    private String email;
    private String phone;

    @JsonProperty(required = false)
    @JsonPropertyDescription(value = "The organisational units (companies/divisions) for which the buyer can place orders.")
    private List<String> organisations;

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public List<String> getOrganisations() {
        if (organisations == null) {
            organisations = new ArrayList<>();
        }
        return organisations;
    }

    public void setOrganisations(List<String> organisations) {
        this.organisations = organisations;
    }
}