X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.api.slc%2Fsrc%2Forg%2Fargeo%2Fapi%2Fslc%2FUnsupportedException.java;fp=org.argeo.api.slc%2Fsrc%2Forg%2Fargeo%2Fapi%2Fslc%2FUnsupportedException.java;h=3a7c766c80f6d952a978df438cc964db9a0c7aa1;hb=d07cf3c7dfdeafa2b1efafe547b54d56a8b52ced;hp=0000000000000000000000000000000000000000;hpb=8596685647867307b862b8a89742b6a62ba75fcd;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.api.slc/src/org/argeo/api/slc/UnsupportedException.java b/org.argeo.api.slc/src/org/argeo/api/slc/UnsupportedException.java new file mode 100644 index 000000000..3a7c766c8 --- /dev/null +++ b/org.argeo.api.slc/src/org/argeo/api/slc/UnsupportedException.java @@ -0,0 +1,54 @@ +package org.argeo.api.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); + } + +}