From 206c4964940dacbbba56a9c7d3c6d16a1ef803eb Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 14 Aug 2015 14:31:15 +0200 Subject: [PATCH] =?utf8?q?Added=20addToDataSet()=20for=20Number=20classes?= =?utf8?q?=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../frontend/BaseDatabaseFrontend.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java b/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java index 0d3f48f..c45f31f 100644 --- a/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java +++ b/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java @@ -92,6 +92,32 @@ public abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implement this.getLogger().trace("EXIT!"); } + /** + * Adds given key-value pair for any numbers to dataset instance. Both must not be null. + * + * @param key Key to set + * @param value Value to set + */ + protected void addToDataSet (final String key, final Number value) { + // Trace message + this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); + + // Is key/value null? + if (key == null) { + // Key is null + throw new NullPointerException("key is null"); + } else if (value == null) { + // Key is null + throw new NullPointerException("value is null"); + } + + // Add it to map + this.dataset.put(key, value); + + // Trace message + this.getLogger().trace("EXIT!"); + } + /** * Clears dataset instance. You should call this before you use it for * inserting data into your database. -- 2.39.5