public final class DatabaseException
extends android.util.AndroidRuntimeException
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_DEFAULT
Default type of database exception.
|
static int |
TYPE_INSTANTIATION
Type of database exception determining that such exception has been thrown due to instantiation
failure of a specific class of which instance is required.
|
static int |
TYPE_MISCONFIGURATION
Type of database exception determining that such exception has been thrown only due to wrong
configuration.
|
static int |
TYPE_MISSING_CLASS_ANNOTATION
Type of database exception determining that such exception has been thrown due to missing
required class annotation.
|
static int |
TYPE_MISSING_FIELD_ANNOTATION
Type of database exception determining that such exception has been thrown due to missing
required field annotation.
|
Modifier and Type | Method and Description |
---|---|
static DatabaseException |
annotationsNotEnabled()
Creates a new instance of DatabaseException type of
TYPE_MISCONFIGURATION with message
saying that annotations are not enabled but functionality that requires annotations to be enabled
has been requested. |
static DatabaseException |
exception(Exception cause)
Creates a new instance of DatabaseException type of
TYPE_DEFAULT . |
static DatabaseException |
exception(String message)
Creates a new instance of DatabaseException type of
TYPE_DEFAULT . |
static DatabaseException |
exception(String message,
Throwable cause)
Creates a new instance of DatabaseException type of
TYPE_DEFAULT . |
int |
getType()
Returns a type of this exception.
|
static DatabaseException |
instantiation(String objectType,
Class<?> classOf,
Throwable cause)
Same as
instantiation(String, Class, Throwable, String) with default additional note. |
static DatabaseException |
instantiation(String objectType,
Class<?> classOf,
Throwable cause,
String note)
Creates a new instance of DatabaseException type of
TYPE_INSTANTIATION for the specified
objectType and classOf. |
static DatabaseException |
misconfiguration(String message)
Creates a new instance of DatabaseException type of
TYPE_MISCONFIGURATION with the
specified message. |
static DatabaseException |
missingClassAnnotation(Class<? extends Annotation> annotation,
Class<?> forClass)
Same as
missingClassAnnotation(Class, Class, String) without additional note. |
static DatabaseException |
missingClassAnnotation(Class<? extends Annotation> annotation,
Class<?> forClass,
String note)
Creates a new instance of DatabaseException type of
TYPE_MISSING_CLASS_ANNOTATION for
the specified annotation and forClass. |
static DatabaseException |
missingFieldAnnotation(Class<? extends Annotation> annotation,
Field field,
Class<?> ofClass)
Same as
missingFieldAnnotation(Class, Field, Class, String) without additional note. |
static DatabaseException |
missingFieldAnnotation(Class<? extends Annotation> annotation,
Field field,
Class<?> ofClass,
String note)
Creates a new instance of DatabaseException type of
TYPE_MISSING_FIELD_ANNOTATION for
the specified annotation and field. |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public static final int TYPE_DEFAULT
public static final int TYPE_MISCONFIGURATION
public static final int TYPE_INSTANTIATION
public static final int TYPE_MISSING_CLASS_ANNOTATION
public static final int TYPE_MISSING_FIELD_ANNOTATION
@NonNull public static DatabaseException exception(String message)
TYPE_DEFAULT
.message
- A message for the new exception.@NonNull public static DatabaseException exception(String message, Throwable cause)
TYPE_DEFAULT
.message
- A message for the new exception.cause
- A cause for the new exception.@NonNull public static DatabaseException exception(Exception cause)
TYPE_DEFAULT
.cause
- A cause for the new exception.@NonNull public static DatabaseException annotationsNotEnabled()
TYPE_MISCONFIGURATION
with message
saying that annotations are not enabled but functionality that requires annotations to be enabled
has been requested.@NonNull public static DatabaseException misconfiguration(@NonNull String message)
TYPE_MISCONFIGURATION
with the
specified message.message
- The message for the new misconfiguration exception.@NonNull public static DatabaseException instantiation(@NonNull String objectType, @NonNull Class<?> classOf, @Nullable Throwable cause)
instantiation(String, Class, Throwable, String)
with default additional note.@NonNull public static DatabaseException instantiation(@NonNull String objectType, @NonNull Class<?> classOf, @Nullable Throwable cause, @NonNull String note)
TYPE_INSTANTIATION
for the specified
objectType and classOf.objectType
- Type (name) of the object of which instantiation has failed.classOf
- Class of the object of which instantiation has failed.cause
- todo:note
- Additional note for the new instantiation exception that will be added at
the end of the exception's message text.@NonNull public static DatabaseException missingClassAnnotation(@NonNull Class<? extends Annotation> annotation, @NonNull Class<?> forClass)
missingClassAnnotation(Class, Class, String)
without additional note.@NonNull public static DatabaseException missingClassAnnotation(@NonNull Class<? extends Annotation> annotation, @NonNull Class<?> forClass, @NonNull String note)
TYPE_MISSING_CLASS_ANNOTATION
for
the specified annotation and forClass.annotation
- Type of the missing annotation that is required for proper working of the
Database library.forClass
- The class that is missing the required annotation.note
- Additional note for the new missing annotation exception that will be added
at the end of the exception's message text.@NonNull public static DatabaseException missingFieldAnnotation(@NonNull Class<? extends Annotation> annotation, @NonNull Field field, @NonNull Class<?> ofClass)
missingFieldAnnotation(Class, Field, Class, String)
without additional note.@NonNull public static DatabaseException missingFieldAnnotation(@NonNull Class<? extends Annotation> annotation, @NonNull Field field, @NonNull Class<?> ofClass, @NonNull String note)
TYPE_MISSING_FIELD_ANNOTATION
for
the specified annotation and field.annotation
- Type of the missing annotation that is required for proper working of the
Database library.field
- The field that is missing the required annotation.ofClass
- A class that is holder of the specified field.note
- Additional note for the new missing annotation exception that will be added
at the end of the exception's message text.public int getType()