public class GomValidationError
extends de.espirit.common.UncheckedException
GomSourceProvider
,
Serialized FormConstructor and Description |
---|
GomValidationError(String message,
GomElement gom,
String detail)
Create a new exception with the given message to be thrown for the provided gom element and a regular expression used
to identify the position of the gom element's detail.
|
GomValidationError(String message,
GomElement gom,
String detail,
UserService userService)
Deprecated.
since 4.2.410 - use
GomValidationError(String,GomElement,String) instead |
Modifier and Type | Method and Description |
---|---|
int[] |
findPosition(String text)
Deprecated.
since 5.0.100 Use
findPosition(String,int) instead. |
Range |
findPosition(String text,
int start)
Find the position causing this exception within the given text from the given start on.
|
Map<String,Object> |
getContext()
Returns the context of this error containing specific error information.
|
GomElement |
getGom()
Get the GOM element.
|
String |
getName()
Get the GomFormElement name.
|
String |
getTag()
Get the GomElement tag.
|
String |
getTarget()
Get the target for identifying the error's origin.
|
void |
putContext(String key,
Object value)
Adds the given value identified by the given key to the context of this error.
|
constructContext, getErrorCode, getLocalizedMessage, isInfoOnly, setErrorCode, wrapOrRethrow
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
@Deprecated public GomValidationError(String message, @NotNull GomElement gom, String detail, UserService userService)
GomValidationError(String,GomElement,String)
insteadmessage
- The exception's message.gom
- The gom element that failed.detail
- The regular expression identifying the detail.userService
- The user service.public GomValidationError(String message, @NotNull GomElement gom, @Nullable String detail)
To identify the correct position of the error, the detail's regular expression should define the erronous part as the first group within the expression. If the expression does not define a group, the cursor is placed at the end of the matching sequence.
For example, having an invalid attribute value, a detail definition with group might look like follows:"\\battrName *= *[\"'](invalidValue)[\"']"
where invalidValue
will be identified as the erronous part.
message
- The exception's message.gom
- The gom element that failed.detail
- The regular expression identifying the detail.public Map<String,Object> getContext()
getContext
in interface de.espirit.common.LocalizableError
getContext
in class de.espirit.common.UncheckedException
public void putContext(String key, Object value)
key
- The key identifying the context object.value
- The context object to be stored.getContext()
@Deprecated public int[] findPosition(String text)
findPosition(String,int)
instead.text
- The text to search in.public Range findPosition(@NotNull String text, int start)
text
- The text to search in.start
- The starting index.null
.public String getName()
GomFormElement.name()
public String getTag()
GomElement.getGomElementTag()
public GomElement getGom()
public String getTarget()
Copyright © 2015 e-Spirit AG. All Rights Reserved. Build 5.1.408