net.sf.qualitycheck.exception
Class IllegalMissingAnnotationException

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

public class IllegalMissingAnnotationException
extends RuntimeException

Thrown to indicate that a method has been passed with a class that does not have a required annotation.

Author:
André Rouél, 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_ANNOTATION
          Message to indicate that the the given class must be annotated with annotation '%s'.
protected static String MESSAGE_WITH_ANNOTATION_AND_CLASS
          Message to indicate that the the given class with name must be annotated with annotation '%s'.
 
Constructor Summary
IllegalMissingAnnotationException()
          Constructs an IllegalMissingAnnotationException with the default message DEFAULT_MESSAGE.
IllegalMissingAnnotationException(Class<? extends Annotation> annotation)
          Constructs an IllegalMissingAnnotationException with the message MESSAGE_WITH_ANNOTATION including the name of the missing annotation.
IllegalMissingAnnotationException(Class<? extends Annotation> annotation, Class<?> clazz)
          Constructs an IllegalMissingAnnotationException with the message MESSAGE_WITH_ANNOTATION including the name of the missing annotation.
IllegalMissingAnnotationException(Class<? extends Annotation> annotation, Class<?> clazz, Throwable cause)
          Constructs a new exception with the message MESSAGE_WITH_ANNOTATION including the name of the missing annotation.
IllegalMissingAnnotationException(Class<? extends Annotation> annotation, Throwable cause)
          Constructs a new exception with the message MESSAGE_WITH_ANNOTATION including the name of the missing annotation.
IllegalMissingAnnotationException(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.
 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_ANNOTATION

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

See Also:
Constant Field Values

MESSAGE_WITH_ANNOTATION_AND_CLASS

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

See Also:
Constant Field Values
Constructor Detail

IllegalMissingAnnotationException

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


IllegalMissingAnnotationException

public IllegalMissingAnnotationException(@Nonnull
                                         Class<? extends Annotation> annotation)
Constructs an IllegalMissingAnnotationException with the message MESSAGE_WITH_ANNOTATION including the name of the missing annotation.

Parameters:
annotation - the required annotation

IllegalMissingAnnotationException

public IllegalMissingAnnotationException(@Nonnull
                                         Class<? extends Annotation> annotation,
                                         @Nullable
                                         Throwable cause)
Constructs a new exception with the message MESSAGE_WITH_ANNOTATION including the name of the missing annotation.

Parameters:
annotation - the required annotation
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.)

IllegalMissingAnnotationException

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

Parameters:
annotation - the required annotation
clazz - the name of the class which does not have the required annotation

IllegalMissingAnnotationException

public IllegalMissingAnnotationException(@Nonnull
                                         Class<? extends Annotation> annotation,
                                         @Nullable
                                         Class<?> clazz,
                                         @Nullable
                                         Throwable cause)
Constructs a new exception with the message MESSAGE_WITH_ANNOTATION including the name of the missing annotation.

Parameters:
annotation - the required annotation
clazz - the name of the class which does not have the required annotation
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.)

IllegalMissingAnnotationException

public IllegalMissingAnnotationException(@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

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

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


Copyright © 2012-2013. All Rights Reserved.