Module net.luis.utils
Record Class TransformTokenAction
java.lang.Object
java.lang.Record
net.luis.utils.io.token.rule.actions.TransformTokenAction
- Record Components:
transformer
- The transformer to apply to tokens
- All Implemented Interfaces:
TokenAction
public record TransformTokenAction(@NotNull TokenTransformer transformer)
extends Record
implements TokenAction
Token action that transforms the tokens using a transformer.
The transformer is applied to the tokens, and the result is returned as an immutable list of tokens.
The transformer is applied to the tokens, and the result is returned as an immutable list of tokens.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NotNull TokenTransformer
The field for thetransformer
record component. -
Constructor Summary
ConstructorsConstructorDescriptionTransformTokenAction
(@NotNull TokenTransformer transformer) Constructs a new transform token action with the given transformer. -
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.final String
toString()
Returns a string representation of this record class.@NotNull TokenTransformer
Returns the value of thetransformer
record component.
-
Field Details
-
transformer
The field for thetransformer
record component.
-
-
Constructor Details
-
TransformTokenAction
Constructs a new transform token action with the given transformer.- Parameters:
transformer
- The transformer to apply to tokens- Throws:
NullPointerException
- If the transformer 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)
. -
transformer
Returns the value of thetransformer
record component.- Returns:
- the value of the
transformer
record component
-