From 4c3f6ebe82e24f38dbe30840c830b22d2a0cbee6 Mon Sep 17 00:00:00 2001 From: Shan Ruhhammer Date: Sun, 25 Jun 2023 03:04:56 +0200 Subject: [PATCH] #11 Added supporting class and exception --- .../exception/InvalidCatalogueException.java | 27 ++++++++++++++++ .../de/rwu/easydrop/model/ProductPair.java | 31 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/main/java/de/rwu/easydrop/exception/InvalidCatalogueException.java create mode 100644 src/main/java/de/rwu/easydrop/model/ProductPair.java diff --git a/src/main/java/de/rwu/easydrop/exception/InvalidCatalogueException.java b/src/main/java/de/rwu/easydrop/exception/InvalidCatalogueException.java new file mode 100644 index 0000000..69e582a --- /dev/null +++ b/src/main/java/de/rwu/easydrop/exception/InvalidCatalogueException.java @@ -0,0 +1,27 @@ +package de.rwu.easydrop.exception; + +/** + * Exception that signifies the data of a Product are invalid. + * + * @since 0.3.0 + */ +public class InvalidCatalogueException extends RuntimeException { + /** + * Throws an exception that signifies the data of a Product are invalid. + * + * @param message + */ + public InvalidCatalogueException(final String message) { + super(message); + } + + /** + * Throws an exception that signifies the data of a Product are invalid. + * + * @param message + * @param cause + */ + public InvalidCatalogueException(final String message, final Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/de/rwu/easydrop/model/ProductPair.java b/src/main/java/de/rwu/easydrop/model/ProductPair.java new file mode 100644 index 0000000..70140c0 --- /dev/null +++ b/src/main/java/de/rwu/easydrop/model/ProductPair.java @@ -0,0 +1,31 @@ +package de.rwu.easydrop.model; + +import lombok.Data; + +/** + * Associates two related Products to one another. + * + * @since 0.3.0 + */ +@Data +public class ProductPair { + /** + * The first product. + */ + private final Product product1; + /** + * The second product. + */ + private final Product product2; + + /** + * Constructs a Product Pair. + * + * @param a First product + * @param b Second product + */ + public ProductPair(final Product a, final Product b) { + this.product1 = a; + this.product2 = b; + } +}