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 boolean
The field for theequalsIgnoreCase
record component.private final @NotNull String
The field for thetoken
record component. -
Constructor Summary
ConstructorsConstructorDescriptionStringTokenDefinition
(@NotNull String token, boolean equalsIgnoreCase) Constructs a new token definition for the given string. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.boolean
Returns the value of theequalsIgnoreCase
record component.final int
hashCode()
Returns a hash code value for this object.boolean
Checks if the given word matches this token definition.@NotNull String
token()
Returns the value of thetoken
record component.@NotNull String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.luis.utils.io.token.definition.TokenDefinition
match
Methods inherited from interface net.luis.utils.io.token.rule.rules.TokenRule
optional, repeatAtLeast, repeatAtMost, repeatBetween, repeatExactly, repeatInfinitely
-
Field Details
-
token
The field for thetoken
record component. -
equalsIgnoreCase
private final boolean equalsIgnoreCaseThe field for theequalsIgnoreCase
record 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:TokenDefinition
Checks if the given word matches this token definition.- Specified by:
matches
in 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 thetoken
record component.- Returns:
- the value of the
token
record component
-
equalsIgnoreCase
public boolean equalsIgnoreCase()Returns the value of theequalsIgnoreCase
record component.- Returns:
- the value of the
equalsIgnoreCase
record component
-