Interface OneOfArraySpec<T>

Type Parameters:
T - type of value
All Superinterfaces:
GeneratorSpec<T>, NullableGeneratorSpec<T>, OneOfArrayGeneratorSpec<T>, ValueSpec<T>

public interface OneOfArraySpec<T> extends ValueSpec<T>, OneOfArrayGeneratorSpec<T>
Spec for selecting a random value from an array.
Since:
2.6.0
  • Method Details

    • oneOf

      ValueSpec<T> oneOf(T... values)
      Description copied from interface: OneOfArrayGeneratorSpec
      Selects a random value from the given choices.
      Specified by:
      oneOf in interface OneOfArrayGeneratorSpec<T>
      Parameters:
      values - from which a random value will be selected
      Returns:
      spec builder
    • toModel

      default Model<T> toModel()
      Description copied from interface: ValueSpec
      Returns the spec as a Model.

      Example:

      
         Model<String> stringModel = Gen.string().length(10).digits().toModel();
         String result = Instancio.create(stringModel);
       
      Specified by:
      toModel in interface ValueSpec<T>
      Returns:
      spec as a model