java.lang.Object
java.lang.Record
net.luis.utils.io.token.rule.actions.WrapTokenAction
- Record Components:
prefixToken
- The prefix tokensuffixToken
- The suffix token
- All Implemented Interfaces:
TokenAction
public record WrapTokenAction(@NotNull Token prefixToken, @NotNull Token suffixToken)
extends Record
implements TokenAction
Token action that wraps the tokens with a prefix and suffix token.
The prefix and suffix tokens are added to the beginning and end of the matched tokens, respectively.
The prefix and suffix tokens are added to the beginning and end of the matched tokens, respectively.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NotNull Token
The field for theprefixToken
record component.private final @NotNull Token
The field for thesuffixToken
record component. -
Constructor Summary
ConstructorsConstructorDescriptionWrapTokenAction
(@NotNull Token prefixToken, @NotNull Token suffixToken) Constructs a new wrap token action with the given prefix and suffix tokens. -
Method Summary
Modifier and TypeMethodDescriptionapply
(@NotNull TokenRuleMatch match) Applies this token action to the given token rule match.
The action can modify, transform or remove the tokens of the match.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@NotNull Token
Returns the value of theprefixToken
record component.@NotNull Token
Returns the value of thesuffixToken
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
prefixToken
The field for theprefixToken
record component. -
suffixToken
The field for thesuffixToken
record component.
-
-
Constructor Details
-
WrapTokenAction
Constructs a new wrap token action with the given prefix and suffix tokens.- Parameters:
prefixToken
- The prefix tokensuffixToken
- The suffix token- Throws:
NullPointerException
- If the prefix or suffix token is null
-
-
Method Details
-
apply
Description copied from interface:TokenAction
Applies this token action to the given token rule match.
The action can modify, transform or remove the tokens of the match.- Specified by:
apply
in interfaceTokenAction
- Parameters:
match
- The token rule match to apply the action to- Returns:
- The resulting immutable list of tokens after applying the action
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
prefixToken
Returns the value of theprefixToken
record component.- Returns:
- the value of the
prefixToken
record component
-
suffixToken
Returns the value of thesuffixToken
record component.- Returns:
- the value of the
suffixToken
record component
-