net.sf.qualitycheck.exception
Class IllegalInstanceOfArgumentException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by net.sf.qualitycheck.exception.IllegalInstanceOfArgumentException
All Implemented Interfaces:
Serializable

public class IllegalInstanceOfArgumentException
extends RuntimeException

Thrown to indicate that a method has been passed with a reference of an unexpected type.

Author:
André Rouél, Dominik Seichter
See Also:
Serialized Form

Field Summary
protected static String DEFAULT_MESSAGE
          Default message to indicate that a given argument must is a member of an unexpected type
protected static String MESSAGE_WITH_NAME_AND_TYPES
          Message to indicate that a given argument with name must is a member of an unexpected type (with current and expected type information)
protected static String MESSAGE_WITH_TYPES
          Message to indicate that a given argument with must is a member of an unexpected type (with current and expected type information)
protected static String NO_TYPE_PLACEHOLDER
          Placeholder for not set types to format a message human readable
 
Constructor Summary
IllegalInstanceOfArgumentException()
          Constructs an IllegalInstanceOfArgumentException with the default message DEFAULT_MESSAGE.
IllegalInstanceOfArgumentException(String argumentName, Class<?> expectedType, Class<?> actualType)
          Constructs an IllegalInstanceOfArgumentException with the message MESSAGE_WITH_NAME_AND_TYPES including the given name of the argument as string representation.
IllegalInstanceOfArgumentException(Throwable cause)
          Constructs a new exception with the default message DEFAULT_MESSAGE.
 
Method Summary
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MESSAGE

protected static final String DEFAULT_MESSAGE
Default message to indicate that a given argument must is a member of an unexpected type

See Also:
Constant Field Values

MESSAGE_WITH_TYPES

protected static final String MESSAGE_WITH_TYPES
Message to indicate that a given argument with must is a member of an unexpected type (with current and expected type information)

See Also:
Constant Field Values

MESSAGE_WITH_NAME_AND_TYPES

protected static final String MESSAGE_WITH_NAME_AND_TYPES
Message to indicate that a given argument with name must is a member of an unexpected type (with current and expected type information)

See Also:
Constant Field Values

NO_TYPE_PLACEHOLDER

protected static final String NO_TYPE_PLACEHOLDER
Placeholder for not set types to format a message human readable

See Also:
Constant Field Values
Constructor Detail

IllegalInstanceOfArgumentException

public IllegalInstanceOfArgumentException()
Constructs an IllegalInstanceOfArgumentException with the default message DEFAULT_MESSAGE.


IllegalInstanceOfArgumentException

public IllegalInstanceOfArgumentException(@Nullable
                                          String argumentName,
                                          @Nullable
                                          Class<?> expectedType,
                                          @Nullable
                                          Class<?> actualType)
Constructs an IllegalInstanceOfArgumentException with the message MESSAGE_WITH_NAME_AND_TYPES including the given name of the argument as string representation.

Parameters:
argumentName - the name of the passed argument
expectedType - the expected class of the given argument
actualType - the actual class of the given argument

IllegalInstanceOfArgumentException

public IllegalInstanceOfArgumentException(@Nullable
                                          Throwable cause)
Constructs a new exception with the default message DEFAULT_MESSAGE.

Parameters:
cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)


Copyright © 2012-2013. All Rights Reserved.