Class GomValidationError
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
de.espirit.common.UncheckedException
de.espirit.firstspirit.access.store.templatestore.gom.GomValidationError
- All Implemented Interfaces:
LocalizableError
,Serializable
This error indicates an invalid gom source.
- Since:
- 4.0.52
- See Also:
-
Constructor Summary
ConstructorDescriptionGomValidationError
(String message, @NotNull GomElement gom, @Nullable 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. -
Method Summary
Modifier and TypeMethodDescriptionfindPosition
(@NotNull String text, int start) Find the position causing this exception within the given text from the given start on.int[]
findPosition
(String text) Deprecated.Returns the context of this error containing specific error information.getGom()
Get the GOM element.getName()
Get the GomFormElement name.getTag()
Get the GomElement tag.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.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GomValidationError
public GomValidationError(String message, @NotNull @NotNull GomElement gom, @Nullable @Nullable 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.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)[\"']"
whereinvalidValue
will be identified as the erronous part.- Parameters:
message
- The exception's message.gom
- The gom element that failed.detail
- The regular expression identifying the detail.- Since:
- 4.2.410
-
-
Method Details
-
getContext
Returns the context of this error containing specific error information.- Since:
- 4.2.200
-
putContext
Adds the given value identified by the given key to the context of this error.- Parameters:
key
- The key identifying the context object.value
- The context object to be stored.- Since:
- 4.2.200
- See Also:
-
findPosition
Deprecated.since 5.0.100 UsefindPosition(String,int)
instead.Tries to find the position causing this exception within the given text.- Parameters:
text
- The text to search in.- Returns:
- The position of the detail or -1.
- Since:
- 4.2.9
-
findPosition
Find the position causing this exception within the given text from the given start on.- Parameters:
text
- The text to search in.start
- The starting index.- Returns:
- A match or
null
. - Since:
- 5.0.100
-
getName
Get the GomFormElement name.- Returns:
- the elements name
- Since:
- 4.2.400
- See Also:
-
getTag
Get the GomElement tag.- Returns:
- the elements name
- Since:
- 4.2.400
- See Also:
-
getGom
Get the GOM element.- Returns:
- The element itself.
- Since:
- 5.0.100
-
getTarget
Get the target for identifying the error's origin.- Returns:
- The target name.
- Since:
- 5.0.100
-
findPosition(String,int)
instead.