net.sf.qualitytest.exception
Class IllegalMissingAnnotationOnMethodException

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

public class IllegalMissingAnnotationOnMethodException
extends RuntimeException

Thrown to indicate that an annotation is missing on a public method of a class.

Author:
Dominik Seichter
See Also:
Serialized Form

Field Summary
protected static String DEFAULT_MESSAGE
          Default message to indicate that the a given class must have an annotation.
protected static String MESSAGE_WITH_METHOD_ANNOTATION_AND_CLASS
          Message to indicate that the the given class with name must be annotated with annotation '%s' on method method.
 
Constructor Summary
IllegalMissingAnnotationOnMethodException()
          Constructs an IllegalMissingAnnotationOnMethodException with the default message DEFAULT_MESSAGE.
IllegalMissingAnnotationOnMethodException(Class<?> clazz, Class<? extends Annotation> annotation, Method method)
          Constructs an IllegalMissingAnnotationOnMethodException with the message IllegalMissingAnnotationOnMethodException#MESSAGE_WITH_ANNOTATION including the name of the missing annotation.
IllegalMissingAnnotationOnMethodException(Class<?> clazz, Class<? extends Annotation> annotation, Method method, Throwable cause)
          Constructs an IllegalMissingAnnotationOnMethodException with the message IllegalMissingAnnotationOnMethodException#MESSAGE_WITH_ANNOTATION including the name of the missing annotation.
IllegalMissingAnnotationOnMethodException(Throwable cause)
          Constructs a new exception with the default message DEFAULT_MESSAGE.
 
Method Summary
 Class<?> getClassWithoutAnnotation()
          Gives access to the class which does not have a required annotation.
 Method getMethodWithoutAnnotation()
          Gives access to the method which does not have a required annotation.
 Class<? extends Annotation> getMissingAnnotation()
          Gives access to the required annotation.
 
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 the a given class must have an annotation.

See Also:
Constant Field Values

MESSAGE_WITH_METHOD_ANNOTATION_AND_CLASS

protected static final String MESSAGE_WITH_METHOD_ANNOTATION_AND_CLASS
Message to indicate that the the given class with name must be annotated with annotation '%s' on method method.

See Also:
Constant Field Values
Constructor Detail

IllegalMissingAnnotationOnMethodException

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


IllegalMissingAnnotationOnMethodException

public IllegalMissingAnnotationOnMethodException(@Nonnull
                                                 Class<?> clazz,
                                                 @Nonnull
                                                 Class<? extends Annotation> annotation,
                                                 @Nonnull
                                                 Method method)
Constructs an IllegalMissingAnnotationOnMethodException with the message IllegalMissingAnnotationOnMethodException#MESSAGE_WITH_ANNOTATION including the name of the missing annotation.

Parameters:
clazz - the name of the class causing the error
annotation - the name of the required annotation
method - the method causing the exception

IllegalMissingAnnotationOnMethodException

public IllegalMissingAnnotationOnMethodException(@Nonnull
                                                 Class<?> clazz,
                                                 @Nonnull
                                                 Class<? extends Annotation> annotation,
                                                 @Nonnull
                                                 Method method,
                                                 @Nullable
                                                 Throwable cause)
Constructs an IllegalMissingAnnotationOnMethodException with the message IllegalMissingAnnotationOnMethodException#MESSAGE_WITH_ANNOTATION including the name of the missing annotation.

Parameters:
clazz - the name of the class causing the error
annotation - the name of the required annotation
method - the method causing the exception
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.)

IllegalMissingAnnotationOnMethodException

public IllegalMissingAnnotationOnMethodException(@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.)
Method Detail

getClassWithoutAnnotation

public Class<?> getClassWithoutAnnotation()
Gives access to the class which does not have a required annotation.

Returns:
the class which caused the exception by not having a required annotation

getMethodWithoutAnnotation

public Method getMethodWithoutAnnotation()
Gives access to the method which does not have a required annotation.

Returns:
the method which caused the exception.

getMissingAnnotation

public Class<? extends Annotation> getMissingAnnotation()
Gives access to the required annotation.

Returns:
the annotation which was expected on a class and was not found


Copyright © 2012-2013. All Rights Reserved.