Interface StructureError
- All Known Implementing Classes:
StructureErrors
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.
Implementation Notes
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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic @interfaceAuxiliary annotation, which may be used on a collection ofStructureErrorinstances to specify the inclusive range of error codes that is taken by that collection. -
Method Summary
Modifier and TypeMethodDescriptiondefault StructureException.Builderbuilder()Creates a new builder forStructureExceptionwith this code.default StructureException.BuilderA shortcut to calling the same method onStructureExceptionbuilder.default StructureException.BuilderforIssue(long issueId) A shortcut to calling the same method onStructureExceptionbuilder.default StructureException.BuilderforItem(ItemIdentity item) A shortcut to calling the same method onStructureExceptionbuilder.default StructureException.BuilderA shortcut to calling the same method onStructureExceptionbuilder.default StructureException.BuilderforStructure(Long structure) A shortcut to calling the same method onStructureExceptionbuilder.default StructureException.BuilderA shortcut to calling the same method onStructureExceptionbuilder.Returns error category.intgetCode()Returns error code.default booleanis(StructureErrorCategory category) Checks if the error is of the given category.default booleanisOneOf(StructureError... errors) Checks if the error is actually one of the provided variants.default booleanisOneOf(StructureErrorCategory... categories) Checks if the error belongs to one of the given categories.default Stringname()Returns error name.default StructureExceptionwithLocalizedMessage(String messageKey, Object... messageParameters) A shortcut to calling the same method onStructureExceptionbuilder.default StructureExceptionwithMessage(String message) A shortcut to calling the same method onStructureExceptionbuilder.default StructureExceptionA shortcut to calling the same method onStructureExceptionbuilder.
-
Method Details
-
getCode
int getCode()Returns error code. -
getCategory
StructureErrorCategory getCategory()Returns error category. -
name
Returns error name. The name is not supposed to tell end-user anything, it is not i18n-ized and can only be written as a diagnostic information. -
is
Checks if the error is of the given category.- Parameters:
category- the category- Returns:
- true if this error belongs to the category
-
isOneOf
Checks if the error belongs to one of the given categories.- Parameters:
categories- categories- Returns:
- true if this error belongs to one of the categories
-
isOneOf
Checks if the error is actually one of the provided variants.- Parameters:
errors- errors to compare to- Returns:
- true if this error is equal to one of the passed errors
-
builder
Creates a new builder forStructureExceptionwith this code.- Returns:
StructureExceptionbuilder
-
withLocalizedMessage
@NotNull default StructureException withLocalizedMessage(@NotNull String messageKey, Object... messageParameters) A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
messageKey- i18n key for the localized error messagemessageParameters- optional i18n message parameters- Returns:
- exception with this code ready to be thrown
-
withMessage
A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
message- non-internationalized message- Returns:
- exception with this code ready to be thrown
-
withoutMessage
A shortcut to calling the same method onStructureExceptionbuilder.- Returns:
- exception with this code ready to be thrown
-
forStructure
A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
structure- related structure ID- Returns:
StructureExceptionbuilder
-
forView
A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
view- related view ID- Returns:
StructureExceptionbuilder
-
forRow
A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
row- related row ID- Returns:
StructureExceptionbuilder
-
forItem
A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
item- related item ID- Returns:
StructureExceptionbuilder
-
forIssue
A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
issueId- related issue ID- Returns:
StructureExceptionbuilder
-
causedBy
A shortcut to calling the same method onStructureExceptionbuilder.- Parameters:
cause- an exception that caused to problem- Returns:
StructureExceptionbuilder
-