X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.specs%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2FUnsupportedException.java;fp=runtime%2Forg.argeo.slc.specs%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2FUnsupportedException.java;h=0102311a840da264bc20d531103e4846699b691a;hb=2f57b9abf7e5110603e8cf952259509c76c9a162;hp=0000000000000000000000000000000000000000;hpb=7804a8856f205e744a374696951c31d0ba068798;p=gpl%2Fargeo-slc.git 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 index 000000000..0102311a8 --- /dev/null +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/UnsupportedException.java @@ -0,0 +1,54 @@ +package org.argeo.slc; + +/** Exception for unsupported features or actions. */ +public class UnsupportedException extends SlcException { + static final long serialVersionUID = 1l; + + /** Action not supported. */ + public UnsupportedException() { + this("Action not supported"); + } + + /** Constructor with a message. */ + public UnsupportedException(String message) { + super(message); + } + + /** + * Constructor generating a message. + * + * @param nature + * the nature of the unsupported object + * @param obj + * the object itself (its class name will be used in message) + */ + public UnsupportedException(String nature, Object obj) { + super("Unsupported " + nature + ": " + + (obj != null ? obj.getClass() : "[object is null]")); + } + + /** + * Constructor generating a message. + * + * @param nature + * the nature of the unsupported object + * @param clss + * the class itself (will be used in message) + */ + public UnsupportedException(String nature, Class clss) { + super("Unsupported " + nature + ": " + clss); + } + + /** + * Constructor generating a message. + * + * @param nature + * the nature of the unsupported object + * @param value + * the problematic value itself + */ + public UnsupportedException(String nature, String value) { + super("Unsupported " + nature + ": " + value); + } + +}