001 /*
002 * (c) 2005, 2009, 2010 ThoughtWorks Ltd
003 * All rights reserved.
004 *
005 * The software in this package is published under the terms of the BSD
006 * style license a copy of which has been included with this distribution in
007 * the LICENSE.txt file.
008 *
009 * Created on 14-July-2005
010 */
011 package com.thoughtworks.proxy.toys.dispatch;
012
013 /**
014 * An exception if a type cannot be dispatched.
015 *
016 * @author Jörg Schaible
017 * @since 0.2
018 */
019 public class DispatchingException extends RuntimeException {
020 private static final long serialVersionUID = 1L;
021 private final Class<?> type;
022
023 /**
024 * Construct a DispatchingException with the offending type.
025 *
026 * @param message the meaningful message
027 * @param type the type, that cannot be dispatched
028 * @since 0.2
029 */
030 public DispatchingException(final String message, final Class<?> type) {
031 super(message);
032 this.type = type;
033 }
034
035 /**
036 * Returns the offending type.
037 *
038 * @return the type
039 * @since 0.2
040 */
041 public Object getType() {
042 return type;
043 }
044 }