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 TokenThe field for theprefixTokenrecord component.private final @NotNull TokenThe field for thesuffixTokenrecord 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 booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull TokenReturns the value of theprefixTokenrecord component.@NotNull TokenReturns the value of thesuffixTokenrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
prefixToken
The field for theprefixTokenrecord component. -
suffixToken
The field for thesuffixTokenrecord 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:TokenActionApplies this token action to the given token rule match.
The action can modify, transform or remove the tokens of the match.- Specified by:
applyin 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 theprefixTokenrecord component.- Returns:
- the value of the
prefixTokenrecord component
-
suffixToken
Returns the value of thesuffixTokenrecord component.- Returns:
- the value of the
suffixTokenrecord component
-