]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/UnsupportedException.java
Refactor package names
[gpl/argeo-slc.git] / runtime / org.argeo.slc.specs / src / main / java / org / argeo / slc / UnsupportedException.java
diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/UnsupportedException.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/UnsupportedException.java
new file mode 100644 (file)
index 0000000..0102311
--- /dev/null
@@ -0,0 +1,54 @@
+package org.argeo.slc;\r
+\r
+/** Exception for unsupported features or actions. */\r
+public class UnsupportedException extends SlcException {\r
+       static final long serialVersionUID = 1l;\r
+\r
+       /** Action not supported. */\r
+       public UnsupportedException() {\r
+               this("Action not supported");\r
+       }\r
+\r
+       /** Constructor with a message. */\r
+       public UnsupportedException(String message) {\r
+               super(message);\r
+       }\r
+\r
+       /**\r
+        * Constructor generating a message.\r
+        * \r
+        * @param nature\r
+        *            the nature of the unsupported object\r
+        * @param obj\r
+        *            the object itself (its class name will be used in message)\r
+        */\r
+       public UnsupportedException(String nature, Object obj) {\r
+               super("Unsupported " + nature + ": "\r
+                               + (obj != null ? obj.getClass() : "[object is null]"));\r
+       }\r
+\r
+       /**\r
+        * Constructor generating a message.\r
+        * \r
+        * @param nature\r
+        *            the nature of the unsupported object\r
+        * @param clss\r
+        *            the class itself (will be used in message)\r
+        */\r
+       public UnsupportedException(String nature, Class<?> clss) {\r
+               super("Unsupported " + nature + ": " + clss);\r
+       }\r
+\r
+       /**\r
+        * Constructor generating a message.\r
+        * \r
+        * @param nature\r
+        *            the nature of the unsupported object\r
+        * @param value\r
+        *            the problematic value itself\r
+        */\r
+       public UnsupportedException(String nature, String value) {\r
+               super("Unsupported " + nature + ": " + value);\r
+       }\r
+\r
+}\r