Class DefinitionException

  • All Implemented Interfaces:
    java.io.Serializable

    public class DefinitionException
    extends java.lang.RuntimeException
    Thrown during registration of types or instances when the type is incorrectly annotated, cannot be constructed or cannot be injected. Retrying the registration will not solve problems of this type and generally points to annotation, visibility or type definition problems. For example:
    • No suitable or ambiguous constructor, for example when no constructors or multiple constructors are inject annotated
    • Injection annotation on a final field or setter without parameters
    • Conflicting scope annotations
    • Registering an abstract type or a generic type with unresolvable type variables
    • Using non-qualifier annotations when registering an instance

    Definition problems can generally be solved by changing the types involved, like adding or removing annotations, changing visibility of fields or methods, etc.; reconfiguring the injector with different annotations or extensions may also solve definition problems.

    Note: this exception specifically does not signal context sensitive problems that could be solved by registering or unregistering additional types; these are considered resolution problems, not definition problems.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DefinitionException​(java.lang.reflect.AnnotatedElement element, java.lang.String message)
      Constructs a new instance.
      DefinitionException​(java.lang.reflect.AnnotatedElement element, java.lang.String message, java.lang.Throwable cause)
      Constructs a new instance.
    • Method Summary

      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DefinitionException

        public DefinitionException​(java.lang.reflect.AnnotatedElement element,
                                   java.lang.String message,
                                   java.lang.Throwable cause)
        Constructs a new instance.
        Parameters:
        element - an AnnotatedElement involved in the definition problem, cannot be null
        message - a message describing the problem, cannot be null
        cause - an underlying cause of the problem, can be null
      • DefinitionException

        public DefinitionException​(java.lang.reflect.AnnotatedElement element,
                                   java.lang.String message)
        Constructs a new instance.
        Parameters:
        element - an AnnotatedElement involved in the definition problem, cannot be null
        message - a message describing the problem, cannot be null