@PublicApi
@PublicSpi
public interface StructureError
StructureError
implementations are wrappers around numeric error codes, which also
provide the error's category (see StructureErrorCategory
) and error name.
This lets the client code distinguish between multiple cases where
StructureException
can be thrown.
StructureError
may also be used to conveniently start a construction of StructureException
.
All public error codes are listed in StructureErrors
.
StructureError
is an interface to allow addition of new error codes without the need
to adjust previously released classes. Structure plugin may have unpublished internal error codes
and Structure extensions may have a collection of their own.
When assigning numeric value to a new error code, please mind that numbers 0—9999 are reserved by ALM Works for Structure and Structure extensions.
StructureException
,
StructureErrors
Modifier and Type | Interface and Description |
---|---|
static interface |
StructureError.CodeRange
Auxiliary annotation, which may be used on a collection of
StructureError instances to specify the
inclusive range of error codes that is taken by that collection. |
Modifier and Type | Method and Description |
---|---|
default StructureException.Builder |
builder()
Creates a new builder for
StructureException with this code. |
default StructureException.Builder |
causedBy(Throwable cause)
A shortcut to calling the same method on
StructureException builder. |
default StructureException.Builder |
forIssue(long issueId)
A shortcut to calling the same method on
StructureException builder. |
default StructureException.Builder |
forItem(ItemIdentity item)
A shortcut to calling the same method on
StructureException builder. |
default StructureException.Builder |
forRow(Long row)
A shortcut to calling the same method on
StructureException builder. |
default StructureException.Builder |
forStructure(Long structure)
A shortcut to calling the same method on
StructureException builder. |
default StructureException.Builder |
forView(Long view)
A shortcut to calling the same method on
StructureException builder. |
StructureErrorCategory |
getCategory()
Returns error category.
|
int |
getCode()
Returns error code.
|
default boolean |
is(StructureErrorCategory category)
Checks if the error is of the given category.
|
default boolean |
isOneOf(StructureError... errors)
Checks if the error is actually one of the provided variants.
|
default boolean |
isOneOf(StructureErrorCategory... categories)
Checks if the error belongs to one of the given categories.
|
default String |
name()
Returns error name.
|
default StructureException |
withLocalizedMessage(String messageKey,
Object... messageParameters)
A shortcut to calling the same method on
StructureException builder. |
default StructureException |
withMessage(String message)
A shortcut to calling the same method on
StructureException builder. |
default StructureException |
withoutMessage()
A shortcut to calling the same method on
StructureException builder. |
int getCode()
StructureErrorCategory getCategory()
@NotNull default String name()
default boolean is(StructureErrorCategory category)
category
- the categorydefault boolean isOneOf(StructureErrorCategory... categories)
categories
- categoriesdefault boolean isOneOf(StructureError... errors)
errors
- errors to compare to@NotNull default StructureException.Builder builder()
StructureException
with this code.StructureException
builder@NotNull default StructureException withLocalizedMessage(@NotNull String messageKey, Object... messageParameters)
StructureException
builder.messageKey
- i18n key for the localized error messagemessageParameters
- optional i18n message parameters@NotNull default StructureException withMessage(@Nullable String message)
StructureException
builder.message
- non-internationalized message@NotNull default StructureException withoutMessage()
StructureException
builder.@NotNull default StructureException.Builder forStructure(@Nullable Long structure)
StructureException
builder.structure
- related structure IDStructureException
builder@NotNull default StructureException.Builder forView(@Nullable Long view)
StructureException
builder.view
- related view IDStructureException
builder@NotNull default StructureException.Builder forRow(@Nullable Long row)
StructureException
builder.row
- related row IDStructureException
builder@NotNull default StructureException.Builder forItem(@Nullable ItemIdentity item)
StructureException
builder.item
- related item IDStructureException
builder@NotNull default StructureException.Builder forIssue(long issueId)
StructureException
builder.issueId
- related issue IDStructureException
builder@NotNull default StructureException.Builder causedBy(@Nullable Throwable cause)
StructureException
builder.cause
- an exception that caused to problemStructureException
builderCopyright © 2024 Tempo Software. All Rights Reserved.