--- /dev/null
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.events.receipt_item.added;
+
+import java.text.MessageFormat;
+import org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem;
+
+/**
+ * An event being fired when a new receipt item has been added by an
+ * administrator.
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public class AdminReceiptItemAddedEvent implements ObservableAdminReceiptItemAddedEvent {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 157_582_667_163_548L;
+
+ /**
+ * New receipt item instance being added
+ */
+ private final BillableReceiptItem addedReceiptItem;
+
+ /**
+ * Constructor with receipt instance
+ * <p>
+ * @param addedReceiptItem Receipt instance
+ */
+ public AdminReceiptItemAddedEvent (final BillableReceiptItem addedReceiptItem) {
+ // Validate parameter
+ if (null == addedReceiptItem) {
+ // Throw NPE
+ throw new NullPointerException("addedReceiptItem is null");
+ } else if (addedReceiptItem.getItemId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("addedReceiptItem.itemId is null");
+ } else if (addedReceiptItem.getItemId() < 1) {
+ // Throw NPE again
+ throw new NullPointerException(MessageFormat.format("addedReceiptItem.itemId={0} is not valid", addedReceiptItem.getItemId()));
+ }
+
+ // Set it here
+ this.addedReceiptItem = addedReceiptItem;
+ }
+
+ @Override
+ public BillableReceiptItem getAddedReceiptItem () {
+ return this.addedReceiptItem;
+ }
+
+}