public interface ParsingContext
Modifier and Type | Method and Description |
---|---|
void |
activateControl(char c)
Activates a control character.
|
void |
advanceLocation(int offset)
Advances the current location by skipping the specified number of characters.
|
void |
deactivateControl(char c)
Indicates that a control character temporarily shouldn't be treated
as a control but a usual content one.
|
void |
enterState(ParsingState state)
Enters the state passed in as the argument which then becomes the current state.
|
ParsingStateCallbackHandler |
getCallbackHandler()
The callback handler used for current parsing.
|
char |
getCharacter()
The character at the current location in the input string.
|
CommandFormatException |
getError()
Returns the exception if there was one during parsing or null
if the line was parsed successfully.
|
String |
getInput()
The complete string being parsed.
|
int |
getLocation()
The current location in the input string.
|
ParsingState |
getState()
The current state.
|
boolean |
isDeactivated(char c)
Checks whether deactivateControl(c) was called for the character
and the character is still not active.
|
boolean |
isEndOfContent()
Checks whether the end of the input string has been reached.
|
boolean |
isLookingFor(char c)
Checks whether the character is the one the parser is looking for.
|
boolean |
isStrict()
Indicates whether handlers should complain by throwing exceptions
in case of issues or be forgiving where possible and there is
a reason to be.
|
ParsingState |
leaveState()
Leaves the current state and and returns it.
|
void |
lookFor(char c)
Indicates that the passed in the argument character is expected
further the line.
|
boolean |
meetIfLookedFor(char c)
This is a convenient safe method which checks whether the passed in
character is the current look-for one.
|
void |
reenterState()
Leaves the current state and then enters it again.
|
boolean |
replaceSpecialChars()
This method is called after a backslash character is met.
|
void |
resolveExpression(boolean systemProperty,
boolean exceptionIfNotResolved)
Replaces system property specified with ${xxx} fomrat or a local variable
whose name is prefixed with '$'.
|
void |
setError(CommandFormatException e)
Sets the error indicating that there was a problem
during parsing.
|
String getInput()
ParsingState getState()
void enterState(ParsingState state) throws CommandFormatException
state
- the state to enterCommandFormatException
- in case something went wrongParsingState leaveState() throws CommandFormatException
CommandFormatException
- in case something went wrongvoid reenterState() throws CommandFormatException
CommandFormatException
- in case something went wrongParsingStateCallbackHandler getCallbackHandler()
char getCharacter()
int getLocation()
boolean isEndOfContent()
void advanceLocation(int offset) throws IndexOutOfBoundsException
offset
- the number of characters to skipIndexOutOfBoundsException
- if the new location exceeds the input string lengthboolean isStrict()
CommandFormatException getError()
void setError(CommandFormatException e)
e
- the errorvoid resolveExpression(boolean systemProperty, boolean exceptionIfNotResolved) throws UnresolvedExpressionException
exceptionIfNotResolved
- whether an exception should be thrown
in case the property or the variable couldn't
be resolved or should it continue unnoticedCommandFormatException
UnresolvedExpressionException
boolean replaceSpecialChars()
void lookFor(char c)
ch
- the character to look forboolean meetIfLookedFor(char c)
c
- the character that should be checked and metboolean isLookingFor(char c)
c
- the character to checkvoid deactivateControl(char c)
c
- control character to deactivatevoid activateControl(char c)
c
- control character to activateboolean isDeactivated(char c)
c
- the character to checkCopyright © 2023 JBoss by Red Hat. All rights reserved.