Package io.debezium.text
Interface TokenStream.Token
-
- All Known Implementing Classes:
TokenStream.CaseInsensitiveToken
,TokenStream.CaseSensitiveToken
- Enclosing class:
- TokenStream
@Immutable public static interface TokenStream.Token
The interface defining a token, which references the characters in the actual input character stream.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
endIndex()
Get the index in the raw stream past the last character in the token.int
length()
Get the length of the token, which is equivalent toendIndex() - startIndex()
.boolean
matches(char expected)
Determine if the token matches the supplied character.boolean
matches(int expectedType)
Determine if the token matches the supplied type.default boolean
matches(int expectedType, String expected)
Determine if the token matches the supplied string and is of a requested type.boolean
matches(String expected)
Determine if the token matches the supplied string.Position
position()
Get the position of this token, which includes the line number and column number of the first character in the token.int
startIndex()
Get the index in the raw stream for the first character in the token.int
type()
Get the type of the token.String
value()
Get the value of the token, in actual case.TokenStream.Token
withType(int typeMask)
Bitmask ORed with existing type value.
-
-
-
Method Detail
-
value
String value()
Get the value of the token, in actual case.- Returns:
- the value
-
matches
boolean matches(String expected)
Determine if the token matches the supplied string.- Parameters:
expected
- the expected value- Returns:
- true if the token's value matches the supplied value, or false otherwise
-
matches
default boolean matches(int expectedType, String expected)
Determine if the token matches the supplied string and is of a requested type.- Parameters:
expectedType
- the expected token typeexpected
- the expected value- Returns:
- true if the token's type and value matches the supplied type and value, or false otherwise
-
matches
boolean matches(char expected)
Determine if the token matches the supplied character.- Parameters:
expected
- the expected character value- Returns:
- true if the token's value matches the supplied character value, or false otherwise
-
matches
boolean matches(int expectedType)
Determine if the token matches the supplied type.- Parameters:
expectedType
- the expected integer type- Returns:
- true if the token's value matches the supplied integer type, or false otherwise
-
type
int type()
Get the type of the token.- Returns:
- the token's type
-
startIndex
int startIndex()
Get the index in the raw stream for the first character in the token.- Returns:
- the starting index of the token
-
endIndex
int endIndex()
Get the index in the raw stream past the last character in the token.- Returns:
- the ending index of the token, which is past the last character
-
length
int length()
Get the length of the token, which is equivalent toendIndex() - startIndex()
.- Returns:
- the length
-
position
Position position()
Get the position of this token, which includes the line number and column number of the first character in the token.- Returns:
- the position; never null
-
withType
TokenStream.Token withType(int typeMask)
Bitmask ORed with existing type value.- Parameters:
typeMask
- the mask of types- Returns:
- copy of Token with new type
-
-