DimensionVO.java
/*
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openwms.wms.inventory.api;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.beans.ConstructorProperties;
import java.io.Serializable;
import java.util.Objects;
import java.util.StringJoiner;
/**
* A DimensionVO encapsulates the capacity.
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class DimensionVO implements Serializable {
/** The height. */
@JsonProperty("height")
@NotNull
private Integer height;
/** The length. */
@JsonProperty("length")
@NotNull
private Integer length;
/** The width. */
@JsonProperty("width")
@NotNull
private Integer width;
/** The Unit of Measure (UOM) of each dimension value. */
@JsonProperty("uom")
@NotBlank
private String uom;
/*~ -------------- Constructors -------------- */
/* For the Mapper */
public DimensionVO() { }
@ConstructorProperties({"height", "length", "width", "uom"})
public DimensionVO(Integer height, Integer length, Integer width, String uom) {
this.height = height;
this.length = length;
this.width = width;
this.uom = uom;
}
/*~ --------------- Accessors ---------------- */
public int getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public Integer getLength() {
return length;
}
public void setLength(Integer length) {
this.length = length;
}
public Integer getWidth() {
return width;
}
public void setWidth(Integer width) {
this.width = width;
}
public String getUom() {
return uom;
}
public void setUom(String uom) {
this.uom = uom;
}
/*~ --------------- Methods ---------------- */
/**
* {@inheritDoc}
*
* All fields.
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof DimensionVO that)) return false;
return Objects.equals(height, that.height) && Objects.equals(length, that.length) && Objects.equals(width, that.width) && Objects.equals(uom, that.uom);
}
/**
* {@inheritDoc}
*
* All fields.
*/
@Override
public int hashCode() {
return Objects.hash(height, length, width, uom);
}
/**
* {@inheritDoc}
*
* All fields.
*/
@Override
public String toString() {
return new StringJoiner(", ", DimensionVO.class.getSimpleName() + "[", "]")
.add("height=" + height)
.add("length=" + length)
.add("width=" + width)
.add("uom='" + uom + "'")
.toString();
}
}