Class ThrowableTypeFactory.AptThrowableType

    • Field Detail

      • type

        private final javax.lang.model.type.TypeMirror type
      • isChecked

        private final boolean isChecked
      • delegate

        private final javax.lang.model.element.Element delegate
      • defaultConstructor

        private boolean defaultConstructor
      • stringConstructor

        private boolean stringConstructor
      • throwableConstructor

        private boolean throwableConstructor
      • stringAndThrowableConstructor

        private boolean stringAndThrowableConstructor
      • throwableAndStringConstructor

        private boolean throwableAndStringConstructor
      • stringType

        protected final javax.lang.model.type.TypeMirror stringType
      • throwableType

        protected final javax.lang.model.type.TypeMirror throwableType
    • Constructor Detail

      • AptThrowableType

        private AptThrowableType​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                                 javax.lang.model.type.TypeMirror type)
        Creates a new descriptor that is not primitive.
        Parameters:
        processingEnv - the annotation processing environment.
        type - the class name of the return type.
    • Method Detail

      • init

        protected void init()
        Initializes the object.
      • init

        protected void init​(java.util.List<? extends javax.lang.model.element.VariableElement> params)
        Allows for additional processing of parameters.
        Parameters:
        params - the parameters to be processed.
      • getDelegate

        public javax.lang.model.element.Element getDelegate()
        Description copied from interface: DelegatingElement
        The element to delegate the default methods to.
        Specified by:
        getDelegate in interface DelegatingElement
        Returns:
        the delegate
      • asType

        public javax.lang.model.type.TypeMirror asType()
        Specified by:
        asType in interface DelegatingElement
        Specified by:
        asType in interface javax.lang.model.element.Element
      • hasDefaultConstructor

        public boolean hasDefaultConstructor()
        Description copied from interface: ThrowableType
        Checks to see the throwable has a default constructor.
        Specified by:
        hasDefaultConstructor in interface ThrowableType
        Returns:
        true if the throwable has a default constructor, otherwise false.
      • hasStringAndThrowableConstructor

        public boolean hasStringAndThrowableConstructor()
        Description copied from interface: ThrowableType
        Checks to see if the throwable has a string and throwable (Throwable(String, Throwable)) constructor.
        Specified by:
        hasStringAndThrowableConstructor in interface ThrowableType
        Returns:
        true if the throwable has both a string and throwable constructor, otherwise false.
      • hasStringConstructor

        public boolean hasStringConstructor()
        Description copied from interface: ThrowableType
        Checks to see if the throwable has a string (Throwable(String)) constructor.

        If true, Throwable.initCause(Throwable) can be used to set the throwable.

        Specified by:
        hasStringConstructor in interface ThrowableType
        Returns:
        true if the throwable has a string constructor, otherwise false.
      • hasThrowableAndStringConstructor

        public boolean hasThrowableAndStringConstructor()
        Description copied from interface: ThrowableType
        Checks to see if the throwable has a throwable and string (Throwable(Throwable, String)) constructor.
        Specified by:
        hasThrowableAndStringConstructor in interface ThrowableType
        Returns:
        true if the throwable has both a throwable and string constructor, otherwise false.
      • hasThrowableConstructor

        public boolean hasThrowableConstructor()
        Description copied from interface: ThrowableType
        Checks to see if the throwable has a string and throwable (Throwable(String, Throwable)) constructor.
        Specified by:
        hasThrowableConstructor in interface ThrowableType
        Returns:
        true if the throwable has a throwable constructor, otherwise false.
      • useConstructionParameters

        public boolean useConstructionParameters()
        Description copied from interface: ThrowableType
        Checks to see if the throwable has and can use a custom constructor.

        If true, the constructor parameters can be retrieved from the ThrowableType.constructionParameters() method.

        Specified by:
        useConstructionParameters in interface ThrowableType
        Returns:
        true if the throwable has a custom constructor that can be used, otherwise false.
      • constructionParameters

        public java.util.Set<Parameter> constructionParameters()
        Description copied from interface: ThrowableType
        The parameters needed to construct the throwable, if not using the default constructor. If the default constructor should be used an empty set should be returned.

        The order the set is returned is the order in which the parameters must be in for the constructor.

        Specified by:
        constructionParameters in interface ThrowableType
        Returns:
        a set of construction parameters or an empty set.
      • isChecked

        public boolean isChecked()
        Description copied from interface: ThrowableType
        Checks if the throwable is a checked exception. If the throwable is a checked exception, true is returned, otherwise false.
        Specified by:
        isChecked in interface ThrowableType
        Returns:
        true if the throwable is a checked exception, otherwise false.
      • name

        public java.lang.String name()
        Description copied from interface: ThrowableType
        Returns the qualified class name of the return type.
        Specified by:
        name in interface ThrowableType
        Returns:
        the qualified class name fo the return type.
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface javax.lang.model.element.Element
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface javax.lang.model.element.Element
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(ThrowableType o)
        Specified by:
        compareTo in interface java.lang.Comparable<ThrowableType>