From adc9e3598c9e2b4eee7f76b18a8cada37031436b Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Wed, 15 Jan 2014 22:02:21 +0100 Subject: [PATCH] [New] new DBC.PRE.assertNull() method --- src/main/java/ch/eitchnet/utils/dbc/DBC.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/ch/eitchnet/utils/dbc/DBC.java b/src/main/java/ch/eitchnet/utils/dbc/DBC.java index 3ea0bb26e..9f83f31f8 100644 --- a/src/main/java/ch/eitchnet/utils/dbc/DBC.java +++ b/src/main/java/ch/eitchnet/utils/dbc/DBC.java @@ -41,11 +41,24 @@ public enum DBC { throw new DbcException(ex); } } + + @Override + public void assertNull(String msg, Object value) { + if (value != null) { + String ex = "Illegal situation as value is not null: {0}"; //$NON-NLS-1$ + ex = MessageFormat.format(ex, msg); + throw new DbcException(ex); + } + } + }; public abstract void assertNotEmpty(String msg, String value); + public abstract void assertNotNull(String msg, Object value); + public abstract void assertNull(String msg, Object value); + public class DbcException extends RuntimeException { private static final long serialVersionUID = 1L;