Package org.jboss.logging.processor.apt
Class ThrowableTypeFactory.AptThrowableType
- java.lang.Object
-
- org.jboss.logging.processor.apt.AbstractClassType
-
- org.jboss.logging.processor.apt.ThrowableTypeFactory.AptThrowableType
-
- All Implemented Interfaces:
java.lang.Comparable<ThrowableType>
,javax.lang.model.AnnotatedConstruct
,javax.lang.model.element.Element
,ClassType
,DelegatingElement
,ThrowableType
- Direct Known Subclasses:
ThrowableTypeFactory.AptReturnThrowableType
- Enclosing class:
- ThrowableTypeFactory
private static class ThrowableTypeFactory.AptThrowableType extends AbstractClassType implements ThrowableType
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
defaultConstructor
private javax.lang.model.element.Element
delegate
private boolean
isChecked
private boolean
stringAndThrowableConstructor
private boolean
stringConstructor
protected javax.lang.model.type.TypeMirror
stringType
private boolean
throwableAndStringConstructor
private boolean
throwableConstructor
protected javax.lang.model.type.TypeMirror
throwableType
private javax.lang.model.type.TypeMirror
type
-
Fields inherited from class org.jboss.logging.processor.apt.AbstractClassType
elements, processingEnv, typeMirror, types
-
-
Constructor Summary
Constructors Modifier Constructor Description private
AptThrowableType(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.type.TypeMirror type)
Creates a new descriptor that is not primitive.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.lang.model.type.TypeMirror
asType()
int
compareTo(ThrowableType o)
java.util.Set<Parameter>
constructionParameters()
The parameters needed to construct the throwable, if not using the default constructor.boolean
equals(java.lang.Object obj)
javax.lang.model.element.Element
getDelegate()
The element to delegate the default methods to.boolean
hasDefaultConstructor()
Checks to see the throwable has a default constructor.int
hashCode()
boolean
hasStringAndThrowableConstructor()
Checks to see if the throwable has a string and throwable (Throwable(String, Throwable)
) constructor.boolean
hasStringConstructor()
Checks to see if the throwable has a string (Throwable(String)
) constructor.boolean
hasThrowableAndStringConstructor()
Checks to see if the throwable has a throwable and string (Throwable(Throwable, String)
) constructor.boolean
hasThrowableConstructor()
Checks to see if the throwable has a string and throwable (Throwable(String, Throwable)
) constructor.protected void
init()
Initializes the object.protected void
init(java.util.List<? extends javax.lang.model.element.VariableElement> params)
Allows for additional processing of parameters.boolean
isChecked()
Checks if the throwable is a checked exception.java.lang.String
name()
Returns the qualified class name of the return type.java.lang.String
toString()
boolean
useConstructionParameters()
Checks to see if the throwable has and can use a custom constructor.-
Methods inherited from class org.jboss.logging.processor.apt.AbstractClassType
isAssignableFrom, isSameAs, isSubtypeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jboss.logging.processor.model.ClassType
isAssignableFrom, isSameAs, isSubtypeOf
-
Methods inherited from interface org.jboss.logging.processor.model.DelegatingElement
accept, getAnnotation, getAnnotationMirrors, getAnnotationsByType, getEnclosedElements, getEnclosingElement, getKind, getModifiers, getSimpleName, isAnnotatedWith
-
Methods inherited from interface org.jboss.logging.processor.model.ThrowableType
causeSetInConstructor
-
-
-
-
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 interfaceDelegatingElement
- Returns:
- the delegate
-
asType
public javax.lang.model.type.TypeMirror asType()
- Specified by:
asType
in interfaceDelegatingElement
- Specified by:
asType
in interfacejavax.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 interfaceThrowableType
- Returns:
true
if the throwable has a default constructor, otherwisefalse
.
-
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 interfaceThrowableType
- Returns:
true
if the throwable has both a string and throwable constructor, otherwisefalse
.
-
hasStringConstructor
public boolean hasStringConstructor()
Description copied from interface:ThrowableType
Checks to see if the throwable has a string (Throwable(String)
) constructor. Iftrue
,Throwable.initCause(Throwable)
can be used to set the throwable.- Specified by:
hasStringConstructor
in interfaceThrowableType
- Returns:
true
if the throwable has a string constructor, otherwisefalse
.
-
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 interfaceThrowableType
- Returns:
true
if the throwable has both a throwable and string constructor, otherwisefalse
.
-
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 interfaceThrowableType
- Returns:
true
if the throwable has a throwable constructor, otherwisefalse
.
-
useConstructionParameters
public boolean useConstructionParameters()
Description copied from interface:ThrowableType
Checks to see if the throwable has and can use a custom constructor. Iftrue
, the constructor parameters can be retrieved from theThrowableType.constructionParameters()
method.- Specified by:
useConstructionParameters
in interfaceThrowableType
- Returns:
true
if the throwable has a custom constructor that can be used, otherwisefalse
.
-
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 interfaceThrowableType
- 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, otherwisefalse
.- Specified by:
isChecked
in interfaceThrowableType
- Returns:
true
if the throwable is a checked exception, otherwisefalse
.
-
name
public java.lang.String name()
Description copied from interface:ThrowableType
Returns the qualified class name of the return type.- Specified by:
name
in interfaceThrowableType
- Returns:
- the qualified class name fo the return type.
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejavax.lang.model.element.Element
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejavax.lang.model.element.Element
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
compareTo
public int compareTo(ThrowableType o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<ThrowableType>
-
-