Record Class Resolver
java.lang.Object
java.lang.Record
jp.co.moneyforward.autotest.framework.action.Resolver
- Record Components:
variableName
- A name of a variable whose value is to be resolved by this object.resolverFunction
- A function that resolves the value.
public record Resolver(String variableName, Function<com.github.dakusui.actionunit.core.Context, Object> resolverFunction)
extends Record
Resolver
figures out a variable designated by variableName
in a context.
Note that a resolver takes a variable name only, and it returns a value for a given variable name.
A resolver provides a "namespace" of variables available for a scene.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Typically, this function is called by a methodresolverFor
and thevariableName
passed to it should be used asvariableNameInScene
for this method.static Resolver
resolverFor
(String variableName, String variableStoreName) Returns aResolver
object, which resolves a value of a variable designated byvariableName
exported by a scenesceneName
.Returns the value of theresolverFunction
record component.resolversFor
(List<String> variableNames, String variableStoreName) Returns a list of resolvers for variables specified byvariableNames
.final String
toString()
Returns a string representation of this record class.Returns the value of thevariableName
record component.
-
Constructor Details
-
Resolver
public Resolver(String variableName, Function<com.github.dakusui.actionunit.core.Context, Object> resolverFunction) Creates an instance of aResolver
record class.- Parameters:
variableName
- the value for thevariableName
record componentresolverFunction
- the value for theresolverFunction
record component
-
-
Method Details
-
resolver
public static Function<com.github.dakusui.actionunit.core.Context, Object> resolver(String variableName, String variableStoreName) Typically, this function is called by a methodresolverFor
and thevariableName
passed to it should be used asvariableNameInScene
for this method.- Parameters:
variableName
- A name of a variable whose value is to be resolved.variableStoreName
- A name of a scene in which the value of the variable is resolved.- Returns:
- A function that gives the value of
variableNameInScene
from aContext
object.
-
resolverFor
Returns aResolver
object, which resolves a value of a variable designated byvariableName
exported by a scenesceneName
. AsceneName
must be a name of a scene, which is guaranteed to be performed one and only once during one test execution.- Parameters:
variableName
- A name of a variable to be resolved by the returnedResolver
.variableStoreName
- A name of a scene by whichvariableName
is exported.- Returns:
- A
Resolver
object.
-
resolversFor
Returns a list of resolvers for variables specified byvariableNames
. Resolvers in the list try to find a variable in a variable store specified byvariableStoreName
.- Parameters:
variableNames
- Names of variables to be resolved by returned resolvers.variableStoreName
- A name of variable store from which values of variables are looked up.- Returns:
- A list of resolvers.
-
toString
-
hashCode
-
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)
. -
variableName
Returns the value of thevariableName
record component.- Returns:
- the value of the
variableName
record component
-
resolverFunction
Returns the value of theresolverFunction
record component.- Returns:
- the value of the
resolverFunction
record component
-