Package com.storedobject.common
Class ErrorText
java.lang.Object
com.storedobject.common.HTMLText
com.storedobject.common.ErrorText
- All Implemented Interfaces:
StyledBuilder
- Direct Known Subclasses:
TransactionControl
The ErrorText class extends the HTMLText class and represents a specialized text container
capable of handling errors and associating error data.
- Author:
- Syam
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.storedobject.common.StyledBuilder
StyledBuilder.Style -
Field Summary
Fields inherited from class com.storedobject.common.HTMLText
ALLOW_TOP_LEVEL, valueFields inherited from interface com.storedobject.common.StyledBuilder
EMPTY_STRINGS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclear()Clear the content.Generates and retrieves an error associated with this instance.getError()Retrieves the error associated with this instance.Retrieves the error object associated with this instance.booleanisError()Checks whether an error is present in this instance.voidSets the error associated with this instance.voidsetErrorObject(Object errorObject) Sets the error object associated with this instance.voidThrows aThrowableerror associated with this instance, if one is present.Methods inherited from class com.storedobject.common.HTMLText
append, append, append, append, appendHTML, clearContent, drawLine, encode, getText, isAllowTopLevelHTML, isEmpty, isNewLine, newLine, newLine, setAllowTopLevelHTML, setText, space, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.storedobject.common.StyledBuilder
setValue, setValue, setValue, update
-
Constructor Details
-
ErrorText
public ErrorText()Default constructor for theErrorTextclass. This constructor initializes an instance ofErrorTextwithout any predefined error object or error state.
-
-
Method Details
-
setErrorObject
Sets the error object associated with this instance. If an error object is already set, this method will not overwrite it.- Parameters:
errorObject- the error object to be associated with this instance. This can be any object containing error-specific details.
-
getErrorObject
Retrieves the error object associated with this instance. The error object may contain details related to an error and is typically set using thesetErrorObjectmethod.- Returns:
- the error object associated with this instance, or
nullif no error object has been set.
-
setError
Sets the error associated with this instance. This method will only overwrite the existing error if the current error isnullor if the new error being set is notnull.- Parameters:
error- theThrowablerepresenting the error to be associated with this instance. It can benullto clear the error if no error is currently associated.
-
getError
Retrieves the error associated with this instance. The returned error is aThrowablethat represents the error condition, ornullif no error has been set.- Returns:
- the
Throwablerepresenting the error associated with this instance, ornullif no error is present.
-
isError
public boolean isError()Checks whether an error is present in this instance.- Returns:
- true if an error is associated with this instance, false otherwise.
-
generateError
Generates and retrieves an error associated with this instance. If an error is already set, it directly returns that error. If no error is set and the instance is not empty, a newSOExceptionis created using the string representation of this instance. If the instance is empty and no error is set,nullis returned.- Returns:
- the
Throwablerepresenting the current error, a newSOExceptionif one needs to be generated, ornullif no error is present and the instance is empty.
-
throwError
Throws aThrowableerror associated with this instance, if one is present. The error is retrieved using thegenerateError()method. If aThrowableis generated and is notnull, it is immediately thrown. If no error is generated or the error isnull, the method completes without any action.- Throws:
Throwable- if an error is generated bygenerateError()and is notnull.
-
clear
-