01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: InvalidContentDataTypeException.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.cmf.format.exceptions;
09:
10: import com.uwyn.rife.cmf.MimeType;
11: import com.uwyn.rife.cmf.format.Formatter;
12:
13: public class InvalidContentDataTypeException extends FormatException {
14: private static final long serialVersionUID = -8080073439600024252L;
15:
16: private Formatter mFormatter = null;
17: private MimeType mMimeType = null;
18: private Class mExpectedType = null;
19: private Class mReceivedType = null;
20:
21: public InvalidContentDataTypeException(Formatter formatter,
22: MimeType mimeType, Class expectedType, Class receivedType) {
23: super ("The formatter '" + formatter.getClass().getName()
24: + "' received content with mime type '" + mimeType
25: + "' and the data should have been of type '"
26: + expectedType.getName() + "', instead it was '"
27: + receivedType.getName() + "'.", null);
28:
29: mFormatter = formatter;
30: mMimeType = mimeType;
31: mExpectedType = expectedType;
32: mReceivedType = receivedType;
33: }
34:
35: public Formatter getFormatter() {
36: return mFormatter;
37: }
38:
39: public MimeType getMimeType() {
40: return mMimeType;
41: }
42:
43: public Class getExpectedType() {
44: return mExpectedType;
45: }
46:
47: public Class getReceivedType() {
48: return mReceivedType;
49: }
50: }
|