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 booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Typically, this function is called by a methodresolverForand thevariableNamepassed to it should be used asvariableNameInScenefor this method.static ResolverresolverFor(String variableName, String variableStoreName) Returns aResolverobject, which resolves a value of a variable designated byvariableNameexported by a scenesceneName.Returns the value of theresolverFunctionrecord component.resolversFor(List<String> variableNames, String variableStoreName) Returns a list of resolvers for variables specified byvariableNames.final StringtoString()Returns a string representation of this record class.Returns the value of thevariableNamerecord component.
-
Constructor Details
-
Resolver
public Resolver(String variableName, Function<com.github.dakusui.actionunit.core.Context, Object> resolverFunction) Creates an instance of aResolverrecord class.- Parameters:
variableName- the value for thevariableNamerecord componentresolverFunction- the value for theresolverFunctionrecord 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 methodresolverForand thevariableNamepassed to it should be used asvariableNameInScenefor 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
variableNameInScenefrom aContextobject.
-
resolverFor
Returns aResolverobject, which resolves a value of a variable designated byvariableNameexported by a scenesceneName. AsceneNamemust 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 whichvariableNameis exported.- Returns:
- A
Resolverobject.
-
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 thevariableNamerecord component.- Returns:
- the value of the
variableNamerecord component
-
resolverFunction
Returns the value of theresolverFunctionrecord component.- Returns:
- the value of the
resolverFunctionrecord component
-