java.lang.Object
java.lang.Record
net.luis.utils.io.token.definition.StringTokenDefinition
- Record Components:
token- The token stringequalsIgnoreCase- If the token should be compared case insensitive
- All Implemented Interfaces:
TokenDefinition,TokenRule
public record StringTokenDefinition(@NotNull String token, boolean equalsIgnoreCase)
extends Record
implements TokenDefinition
Token definition for a string.
This token definition matches a string that is equal to the token string.
This token definition matches a string that is equal to the token string.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for theequalsIgnoreCaserecord component.private final @NotNull StringThe field for thetokenrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionStringTokenDefinition(@NotNull String token, boolean equalsIgnoreCase) Constructs a new token definition for the given string. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theequalsIgnoreCaserecord component.final inthashCode()Returns a hash code value for this object.booleanChecks if the given word matches this token definition.@NotNull Stringtoken()Returns the value of thetokenrecord component.@NotNull StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.luis.utils.io.token.definition.TokenDefinition
matchMethods inherited from interface net.luis.utils.io.token.rule.rules.TokenRule
optional, repeatAtLeast, repeatAtMost, repeatBetween, repeatExactly, repeatInfinitely
-
Field Details
-
token
The field for thetokenrecord component. -
equalsIgnoreCase
private final boolean equalsIgnoreCaseThe field for theequalsIgnoreCaserecord component.
-
-
Constructor Details
-
StringTokenDefinition
Constructs a new token definition for the given string.- Parameters:
token- The token stringequalsIgnoreCase- If the token should be compared case insensitive- Throws:
NullPointerException- If the token is nullIllegalArgumentException- If the token is empty
-
-
Method Details
-
matches
Description copied from interface:TokenDefinitionChecks if the given word matches this token definition.- Specified by:
matchesin interfaceTokenDefinition- Parameters:
word- The word to check- Returns:
- True if the word matches this token definition, false otherwise
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
token
Returns the value of thetokenrecord component.- Returns:
- the value of the
tokenrecord component
-
equalsIgnoreCase
public boolean equalsIgnoreCase()Returns the value of theequalsIgnoreCaserecord component.- Returns:
- the value of the
equalsIgnoreCaserecord component
-