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

com.revinate.ship.common.TimeSpan Maven / Gradle / Ivy

There is a newer version: 1.6.0
Show newest version
package com.revinate.ship.common;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import javax.validation.constraints.NotNull;
import java.time.OffsetDateTime;

@Getter
@Setter
@NoArgsConstructor
@Builder
@EqualsAndHashCode
@ToString
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TimeSpan {

    public enum TimeUnitType {
        DAY, HOUR, MINUTE
    }

    @JsonProperty(required = true)
    @NotNull
    private OffsetDateTime startTime;

    @JsonProperty(required = true)
    @NotNull
    private Integer timeUnits;

    @JsonProperty(required = true)
    @NotNull
    private TimeUnitType timeUnitType;

    @JsonIgnore
    public TimeSpan(OffsetDateTime startTime, Integer timeUnits, TimeUnitType timeUnitType) {
        this.startTime = startTime;
        this.timeUnits = timeUnits;
        this.timeUnitType = timeUnitType;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy