Interface EnumSpec<E extends Enum<E>>

Type Parameters:
E - enum type
All Superinterfaces:
EnumGeneratorSpec<E>, GeneratorSpec<E>, NullableGeneratorSpec<E>, ValueSpec<E>

public interface EnumSpec<E extends Enum<E>> extends ValueSpec<E>, EnumGeneratorSpec<E>
Spec for generating enums.
Since:
2.12.0
  • Method Summary

    Modifier and Type
    Method
    Description
    excluding(E... values)
    Generate an enum while excluding the specified values.
    Specifies that a null value can be generated
    default Model<E>
    toModel() is not supported by this spec.

    Methods inherited from interface org.instancio.generator.ValueSpec

    get, list, map, stream
  • Method Details

    • excluding

      EnumSpec<E> excluding(E... values)
      Generate an enum while excluding the specified values. The argument can be an empty array, but not null.
      Specified by:
      excluding in interface EnumGeneratorSpec<E extends Enum<E>>
      Parameters:
      values - to exclude
      Returns:
      spec builder
      Since:
      2.12.0
    • nullable

      EnumSpec<E> nullable()
      Specifies that a null value can be generated
      Specified by:
      nullable in interface EnumGeneratorSpec<E extends Enum<E>>
      Specified by:
      nullable in interface NullableGeneratorSpec<E extends Enum<E>>
      Specified by:
      nullable in interface ValueSpec<E extends Enum<E>>
      Returns:
      spec builder reference
      Since:
      2.12.0
    • toModel

      default Model<E> toModel()
      toModel() is not supported by this spec.

      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<E extends Enum<E>>
      Returns:
      spec as a model
      Since:
      2.12.0