1 /** 2 * 2007, Digitalis Informatica. All rights reserved. Distribuicao e Gestao de Informatica, Lda. Estrada de Paco de Arcos 3 * num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 http://www.digitalis.pt 4 */ 5 6 package pt.digitalis.dif.exception.codegen; 7 8 import java.util.Map; 9 10 /** 11 * Represents a DEM annotation misuse exception. It's an abstract class whose <code>translate()</code> must be 12 * implemented on the subclasses. Defines the keys that should be used on the context by all subclasses. 13 * 14 * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a><br/> 15 * @created 2007/11/27 16 */ 17 abstract public class AnnotationMisuseException extends DIFCodeGenerationException { 18 19 /** Nested static class which defines the keys used on the exception context. */ 20 static public class ContextKeys { 21 22 /** The 'annotation scope' key. */ 23 final static public String ANNOTATION_SCOPE = "annotationScope"; 24 25 /** The 'annotation found' key. */ 26 final static public String ANNOTATIONS_FOUND = "annotationsFound"; 27 28 /** The 'attribute' key. */ 29 final static public String ATTRIBUTE = "attribute"; 30 31 /** The 'class' key. */ 32 final static public String CLASS = "class"; 33 34 /** The 'message' key. */ 35 final static public String MESSAGE = "message"; 36 37 /** The 'method' key. */ 38 final static public String METHOD = "method"; 39 }; 40 41 /** Serial Version ID. */ 42 private static final long serialVersionUID = 6690908007977245072L; 43 44 /** 45 * Constructs a new AnnotationMisuseException from a reason, an exception and an exception context. 46 * 47 * @param reason 48 * the exception reason. 49 * @param exception 50 * the exception to encapsulate. 51 * @param exceptionContext 52 * the exception context. 53 */ 54 public AnnotationMisuseException(String reason, Exception exception, Map<String, Object> exceptionContext) 55 { 56 super(reason, exception); 57 super.setExceptionContext(exceptionContext); 58 } 59 60 /** 61 * Constructs a new AnnotationMisuseException from a reason and an exception context. 62 * 63 * @param reason 64 * the exception reason. 65 * @param exceptionContext 66 * the exception context. 67 */ 68 public AnnotationMisuseException(String reason, Map<String, Object> exceptionContext) 69 { 70 super(reason); 71 super.setExceptionContext(exceptionContext); 72 } 73 }