Package org.instancio

Interface ValueOf


@ExperimentalApi public interface ValueOf
Value of a target selector of an assignment.
Since:
3.0.0
See Also:
  • Method Details

    • to

      Specifies the destination selector for the assignment.
      Parameters:
      destination - selector
      Returns:
      an assigment containing origin and destination selectors
      Since:
      3.0.0
    • to

      <T, R> ValueOfOriginDestination to(GetMethodSelector<T,R> destination)
      Specifies the destination method reference for the assignment. This is a shorthand API of to(TargetSelector) allowing:
      
       to(field(Pojo::getValue))
       

      to be specified as a slightly shorter version:

      
       to(Pojo::getValue)
       
      Type Parameters:
      T - type declaring the method
      R - return type of the method
      Parameters:
      destination - method reference
      Returns:
      an assigment containing origin and destination selectors
      Since:
      3.0.0
    • generate

      <T> Assignment generate(GeneratorSpecProvider<T> gen)
      Generates values using built-in generators provided by the gen parameter, of type Generators.

      This method provides the same functionality as the top-level API: InstancioApi.generate(TargetSelector, GeneratorSpecProvider)

      Type Parameters:
      T - the type of object to generate
      Parameters:
      gen - provider of customisable built-in generators (also known as specs)
      Returns:
      an assignment
      Since:
      3.0.0
    • generate

      <T> Assignment generate(GeneratorSpec<T> spec)
      Generates values using arbitrary generator specs.

      This method provides the same functionality as the top-level API: InstancioApi.generate(TargetSelector, GeneratorSpec)

      Type Parameters:
      T - the type of object to generate
      Parameters:
      spec - generator spec for generating values
      Returns:
      an assignment
      Since:
      3.0.0
    • set

      <T> Assignment set(T value)
      Sets a value to matching selector targets.

      This method provides the same functionality as the top-level API: InstancioApi.set(TargetSelector, Object)

      Type Parameters:
      T - the type of object to set
      Parameters:
      value - value to set
      Returns:
      an assignment
      Since:
      3.0.0
    • supply

      <T> Assignment supply(Generator<T> generator)
      Supplies an object using a Generator to matching selector targets.

      This method provides the same functionality as the top-level API: InstancioApi.supply(TargetSelector, Generator)

      Type Parameters:
      T - the type of object to generate
      Parameters:
      generator - for generating values
      Returns:
      an assignment
      Since:
      3.0.0
    • supply

      <T> Assignment supply(Supplier<T> supplier)
      Supplies an object using a Supplier.

      This method provides the same functionality as the top-level API: InstancioApi.supply(TargetSelector, Supplier)

      Type Parameters:
      T - the type of object to supply
      Parameters:
      supplier - for supplying values
      Returns:
      an assignment
      Since:
      3.0.0