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
    Constructor
    Description
    Resolver(String variableName, Function<com.github.dakusui.actionunit.core.Context, Object> resolverFunction)
    Creates an instance of a Resolver record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static Function<com.github.dakusui.actionunit.core.Context, Object>
    resolver(String variableName, String variableStoreName)
    Typically, this function is called by a method resolverFor and the variableName passed to it should be used as variableNameInScene for this method.
    static Resolver
    resolverFor(String variableName, String variableStoreName)
    Returns a Resolver object, which resolves a value of a variable designated by variableName exported by a scene sceneName.
    Function<com.github.dakusui.actionunit.core.Context, Object>
    Returns the value of the resolverFunction record component.
    static List<Resolver>
    resolversFor(List<String> variableNames, String variableStoreName)
    Returns a list of resolvers for variables specified by variableNames.
    final String
    Returns a string representation of this record class.
    Returns the value of the variableName record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Resolver

      public Resolver(String variableName, Function<com.github.dakusui.actionunit.core.Context, Object> resolverFunction)
      Creates an instance of a Resolver record class.
      Parameters:
      variableName - the value for the variableName record component
      resolverFunction - the value for the resolverFunction 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 method resolverFor and the variableName passed to it should be used as variableNameInScene 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 a Context object.
    • resolverFor

      public static Resolver resolverFor(String variableName, String variableStoreName)
      Returns a Resolver object, which resolves a value of a variable designated by variableName exported by a scene sceneName. A sceneName 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 returned Resolver.
      variableStoreName - A name of a scene by which variableName is exported.
      Returns:
      A Resolver object.
    • resolversFor

      public static List<Resolver> resolversFor(List<String> variableNames, String variableStoreName)
      Returns a list of resolvers for variables specified by variableNames. Resolvers in the list try to find a variable in a variable store specified by variableStoreName.
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • variableName

      public String variableName()
      Returns the value of the variableName record component.
      Returns:
      the value of the variableName record component
    • resolverFunction

      public Function<com.github.dakusui.actionunit.core.Context, Object> resolverFunction()
      Returns the value of the resolverFunction record component.
      Returns:
      the value of the resolverFunction record component