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

com.revinate.ship.result.GuestStayResult Maven / Gradle / Ivy

package com.revinate.ship.result;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.revinate.ship.gueststay.GuestStay;
import lombok.*;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GuestStayResult extends Result {

    // guestStay is not necessarily valid
    private GuestStay guestStay;

    @Valid
    private List errors;

    @Valid
    private List warnings;

    public void addError(Result error) {
        if (Objects.isNull(this.errors)) {
            this.errors = new ArrayList<>();
        }
        this.errors.add(error);
    }

    public void addErrors(Collection errors) {
        if (Objects.isNull(this.errors)) {
            this.errors = new ArrayList<>();
        }
        this.errors.addAll(errors);
    }

    public void addWarning(Result warning) {
        if (Objects.isNull(this.warnings)) {
            this.warnings = new ArrayList<>();
        }
        this.warnings.add(warning);
    }

    public void addWarnings(Collection warnings) {
        if (Objects.isNull(this.warnings)) {
            this.warnings = new ArrayList<>();
        }
        this.warnings.addAll(warnings);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy